Timeouts and lost connections
A session never waits without a limit, and it always ends with a sentence that says what happened. This page lists every wait, how long it lasts, what the session says when it gives up, and what you can change. It also says what each host sees when rheaCRT itself stops, on purpose or not.
It covers SSH sessions and serial consoles. Local shells end when the shell exits, and report its exit code.
Before you are signed in (SSH)
| Waiting for | Limit | Setting | What you see when it passes |
|---|---|---|---|
| The host to accept the connection | 15 seconds | Connect timeout | no answer from HOST:PORT within 15 seconds |
| The host to answer as an SSH server and finish the handshake | 15 seconds | Connect timeout | HOST:PORT accepted the connection but did not answer as an SSH server within 15 seconds |
| The host to answer one step of signing in | 2 minutes | Sign-in timeout | the host did not answer the sign-in within 120 seconds |
| The host to open the terminal after sign-in | 2 minutes | Sign-in timeout | the host did not answer the request for a terminal within 120 seconds |
Two endings here are not timeouts:
- A host that refuses the connection:
could not connect to HOST:PORT: No connection could be made because the target machine actively refused it. This takes about 2 seconds, because Windows does not take the first refusal as final and asks twice more. - A host that accepts and then closes before the handshake is done, because it is not an SSH server or it is turning clients away:
the connection was lost during the SSH handshake: .... This is reported at once.
The second row of the table is the one to know. A host can accept a connection and then say nothing: a service that has hung, the wrong port, or a load balancer with nothing behind it. rheaCRT tells that apart from a host that never answered, because the fix is different.
Your time is never counted. While a question is on screen (trust this host key, a password, a passphrase, allow legacy algorithms) the clock is stopped. Take as long as you need to check a fingerprint. The host gets a fresh limit once you answer.
A connection lost at a sign-in prompt ends the session there. If the host or the network drops the connection while a user name, password, passphrase or one-time code prompt is up, the session says so straight away. You are not left typing a password into a session that has already gone.
The host-key question is the exception. While it is on screen a lost connection is not seen; it shows the moment you answer. An answer of "yes and save" is still saved, so connecting again goes straight through.
While you are connected (SSH)
| What happens | How fast it is noticed | What you see |
|---|---|---|
The host ends the shell (exit, logout) | At once | connection closed (exit 0) |
| The host disconnects and gives a reason (an idle limit, a shutdown) | At once | the host closed the connection: REASON |
| The connection is closed with no reason given | At once | the connection was lost: the host or the network closed it |
| The connection is reset (a firewall, a restarting host) | At once | the connection was lost: it was reset by the host or the network |
| The link goes dead with no word at all (a cable pulled further along, a VPN that dropped) | 2½ minutes | the connection was lost: the host did not answer 4 keep-alive messages over 150 seconds |
"At once" means within one 16 millisecond step of the test's clock on Windows, and 1 to 8 milliseconds on Linux, where the clock is finer.
Windows reports a connection as "aborted" when the host closes it while rheaCRT is sending. That says no more than "closed", so rheaCRT words it the same way.
Keep-alive messages
A dead link sends nothing, not even an error, so the only way to find it is to ask. After 30 seconds without a byte from the host, rheaCRT sends a keep-alive message. If four in a row go unanswered, the session ends. That is 150 seconds from the last byte: 30 seconds of silence before the first message, then four more intervals.
Any byte from the host resets the count, so a link that drops out and comes back within that time carries on, and nothing is lost: output that was on its way arrives in order. Time in which rheaCRT itself is not reading (see "When a window stops drawing") is not counted either: the host cannot answer what was not listened for. This is deliberate. A session that survives a Wi-Fi handover or a VPN renegotiation is worth more than one that reports a dead link a minute sooner.
Keep-alive messages also stop firewalls and address translators from forgetting an idle session.
They start once you are signed in. Before that, the limits in the first table do the watching.
Closing a session
Closing a tab ends its session whatever the session is doing: connecting, waiting for a silent host, waiting for a sign-in answer, or sending a large paste into a link that has died. The end is reported at once.
If the host can still hear, rheaCRT then sends the SSH goodbye (the disconnect message), closes its own side of the connection, and waits for the host to close the other. The wait is what lets a host that is in the middle of sending read the goodbye: a connection closed on top of unread output is reset by the system, and the reset can reach the host first. rheaCRT waits at most half a second, then lets go whatever the host has done.
When rheaCRT itself stops
A session left half-open on a device holds one of that device's few lines until the device's own timer frees it. So every connection is ended when rheaCRT stops, and each host is told where that is possible.
| What happens | What each host sees | Measured on Windows, 11 sessions |
|---|---|---|
| You quit rheaCRT with sessions open | The SSH goodbye, then the connection closed in order | All 11 within 3 ms. rheaCRT waits at most 1 second. |
| A fault inside one session | The SSH goodbye for that session. Its tab says the session was stopped by a fault inside rheaCRT, and its connection was closed. The other sessions carry on. | Ended in 77 ms; the session beside it answered 15 ms later |
| A fault that stops the whole program | The SSH goodbye on every session, as for a quit | See Limits |
| rheaCRT is killed, or the system ends it | The connection reset, with no goodbye: none of rheaCRT's code runs, and Windows closes the connections | All 11 within 5 ms |
| The computer loses power or drops off the network | Nothing. Each host finds out by its own timers. |
A host that gets the goodbye knows the session was ended on purpose, and logs it so. A host that only sees the connection go cannot tell a crash from a pulled cable. In both cases the session on the host is over at once.
With 11 hosts sending as fast as they could at the moment rheaCRT stopped, all 11 read the goodbye.
Ending a session does not undo what was typed into it. On many network devices, debugging that a session switched on stays on after that session has gone. Connect again and switch it off.
Faults are recorded in rheacrt.log, in rheaCRT's data folder (%LOCALAPPDATA%\rheaCRT).
Typing while output floods
Input does not wait behind output. A line typed into a session that is receiving a flood goes to the host ahead of the output that is still to be drawn.
Measured in the engine on Windows, with nothing drawn on screen: 11 sessions open, every host sending lines as fast as rheaCRT would take them (about 20,000 lines a second each, 224,000 in all), and the same line sent to all 11 at once.
| The line is read by its host | Typical | Slowest |
|---|---|---|
| Every window taking output as fast as it comes | 1.8 ms | 6.7 ms |
| Every window slow (half a megabyte a second each) | 0.5 ms | 1.7 ms |
| Every window stopped | 0.6 ms | 0.8 ms |
5.9 million lines were delivered in that run, none lost and none out of order.
The screen is behind the host by what was already on its way. Output is shown in order, so the answer to a line appears after the output the host sent before it. An SSH host may send 2 MiB ahead of what has been taken. At this flood that was about a second: the answer appeared after 1.1 seconds, typically, and after a line that stops the output every session was quiet 1.1 seconds later. Equipment that sends less than rheaCRT can take has no such lag.
When a window stops drawing
A window can stop taking output: it is hidden and the system has slowed it, or a dialog is holding it up. The session then keeps a little of the host's output ready (256 KiB) and stops reading the connection, so the host is held back as it would be by any slow reader, and nothing is lost. Three things still hold:
- What you type still goes out. See the table above.
- The session is not given up. While rheaCRT is not reading, it cannot hear the host answer keep-alive messages, so that time is not counted against the host. Measured: a window stopped for 8 seconds, with a keep-alive limit of 5; the session stayed up, and everything the host had sent then arrived in order.
- Closing still works, at once.
Large pastes
A host echoes what it reads, and it reads only as fast as its echo is taken. rheaCRT keeps reading while it sends, so a paste of any size goes through, including into equipment that accepts only a few kilobytes at a time. While a paste is being sent, input typed after it waits its turn, so order is kept.
Two things make this hold. The session takes the host's output while a send is waiting for the host to accept more. And a write never waits for the network: what the socket cannot take at once is held, up to 4 MiB, and goes out as the socket takes it. The second matters most on Windows, whose sockets hold far less than Linux's. Measured on Windows: 8 MiB pasted and echoed in 0.31 seconds.
Serial consoles
| What happens | How fast it is noticed | What you see |
|---|---|---|
| The cable or its adapter is unplugged | Within about 50 milliseconds | COM3 stopped: REASON (cable unplugged?) |
| The port stops taking data | On the next send | the port stopped accepting data |
| You close the tab | Within about 50 milliseconds | disconnected |
A serial line has no keep-alive: a device that is powered off, or a cable unplugged at the far end, looks exactly like a device with nothing to say. Only the near end can be seen.
Settings
All three are per session, and inherited like every other setting: all sessions, then the folder, then the session.
| Setting | In the session file | Default | Range | Why this default |
|---|---|---|---|---|
| Connect timeout | [connection] connect_timeout_secs | 15 | 0 to 600 | A host that is going to answer does so well within 15 seconds, and it is short enough to wait out. It applies to reaching the host, and again to the handshake. |
| Sign-in timeout | [connection] sign_in_timeout_secs | 120 | 0 to 3600 | The answer can depend on a person: an approval on a phone, a touch on a security key. An OpenSSH server allows the same two minutes. It applies to each step, not to the whole sign-in. |
| Keep-alive interval | [security] keepalive_secs | 30 | 0 to 3600 | Short enough to keep firewalls from dropping an idle session, long enough to cost nothing. |
0 switches a limit off. With the connect timeout at 0 the session waits as long as the operating system does. With the keep-alive interval at 0 a dead link is not noticed until you type and the system gives up on delivering it, which can take many minutes.
The number of unanswered keep-alive messages (4) is fixed.
These settings are in the session files today. They get a place in session Properties with the rest of the SSH settings.
Checked against real servers
Everything above is measured against a server built into the tests. The same engine was then run against OpenSSH 9.6 on two other machines, across the internet, with faults put on the line by a relay on the testing computer and, for two of them, made on the host itself. The keep-alive interval was 2 seconds, so a dead link is given up after 10.
| What was done | What the session did |
|---|---|
| The line dead for 3 to 4 seconds: both ways, toward the session only, toward the host only | Carried on. A stream and a paste under way arrived whole and in order. |
| The line slowed to 32 KiB a second, or dropping several times a second | The same |
| The line dead for good, either way or both | Ended 10.0 to 10.5 seconds later, with the keep-alive sentence |
| The host's server process stopped, so that it stays connected and answers nothing | Ended 10.0 seconds after its last byte, with the keep-alive sentence |
| The line reset | Ended in under 1 ms, saying it was reset |
| The line closed | Ended within 30 ms, saying it was closed |
| The host's server process killed | Ended 14 to 60 ms later: one trip across the network |
| The connection cut before the shell, at 31 points from the first byte to the last | Ended every time, at its limit, with the sentence for the stage it had reached |
| The whole line down under six sessions at once | All six ended saying so. Six new sessions asked for in the same moment were all ready within 1.5 seconds. |
Two silences with no byte between them count as one: a line that drops, comes back for an instant without anything getting through, and drops again is given up 10 seconds after the last byte heard, not 10 seconds after the second drop.
With nothing in the way: a typed command was answered in 14 ms; 2 million numbered lines arrived in order; a 4 MiB paste of every byte value matched the host's own checksum; and Ctrl+C into a flood was answered 14 ms after the key. After a session was ended by a fault, a new one to the same host was ready in about 0.4 seconds. Sessions beside the one with the fault were not disturbed.
Then faults at random, for 30 minutes, on both machines at once, four sessions on each. 1,220 sessions were started and 1,332 connections were ended by a fault, each with the right sentence in the right time: a silence ended its session between 10.0 and 10.9 seconds later, every time. 350 million numbered lines were checked in order, 691 MiB of pastes matched the hosts' checksums, and 12,558 commands were answered, in 16 ms typically, while faults were being made on the sessions beside them. At the end neither the testing computer nor either host was left holding anything.
Nothing was changed on either host, and the hosts' own defences recorded nothing against the testing computer: only correct sign-ins were ever attempted.
Limits
- A link that goes dead while a window is not drawing is noticed only after drawing resumes, 150 seconds later at the default setting.
- There is no control yet for sending one line to several sessions. The figures above are for the engine, which was given the same line on each session's input.
- The goodbye at quit, and at a fault that stops the whole program, is tested in the engine (
Context::end_all). The window's part is one call on its way out and one in its fault handler; no test runs the real window through either yet. - A name that resolves to several addresses is given one connect timeout for all of them, not one each.
- Nothing warns you during the 150 seconds before a dead link is given up. A notice in the status line after the first unanswered keep-alive is planned.
- rheaCRT does not reconnect by itself yet. Reconnecting, with a choice between asking and doing it automatically, is planned.
- The serial figures were measured on a pseudo-terminal pair on Linux. The session code is the same on Windows, but the driver beneath it is not: a real cable on a real COM port is still to be tested.
Where it lives in the code
crates/core/src/ssh2.rs: the limits (within,within_host_time,answer), the sentences (how_lost,Client::disconnected,FAULT), the close path (Connection,Counted, andCounted::poll_shutdownfor the close in order), the socket that never makes a write wait (Counted,WRITE_AHEAD), the session loop (run), the program's end (Context::end_all), the fault inside one session (Caught), and the window that falls behind or stops (Wire,READ_AHEAD,Backlog, andCounted::silent_too_long, which is what decides that a link is dead).crates/app/src/bridge.rs(goodbye),window.rs(on the way out of the event loop) andfault.rs(the fault handler): where the window calls the program's end.crates/core/src/prompt.rs:Terminal::asking, which stops the clock while a question is on screen.crates/core/src/serial.rs: the serial reader and writer.crates/core/src/settings.rs: the settings and their ranges.- Tests:
crates/core/tests/live_faults.rs(24 tests over live SSH connections, with a relay that can go quiet, be pulled or be reset, and a stand-in program that is killed),crates/core/tests/live_load.rs(the flood on 11 sessions) andcrates/core/tests/serial_line.rs.scripts/test-windows.shruns them as native Windows programs; the figures on this page are from that run unless it says otherwise.