Repository navigation
Notice a dead session in ~6 s instead of ~15, and reconnect sooner - #71
Merged
Merged
Conversation
After a network change port 2010 came back ~18 s later. Nearly all of that was detection: JSch's ServerAliveInterval at 5 s x 3 is ~15 s of silence before the session is dropped. Then the connection check (every 2 s) and the first reconnect (after 1 s); the reconnect itself takes ~0.6 s. - ServerAliveInterval 2 s x 3: a session that hears nothing from the server for ~6 s is dead. The server answers keepalives at once, so a healthy connection, busy or idle, is never that quiet. - Connection check every 500 ms. First reconnect after 250 ms. - Retries 2 s apart while the network is still down, so the first attempt that can get through does not wait long once it is back. 75 retries keep the ~150 s before the tunnel is rebuilt. Measured against a real tunnel VM: - NAT change (old flow blackholed on both ends): 2010 back after 8 s, was ~18-24 s. - 4 s outage: no reconnect. - 20 s outage: 23.6 s, was 25.1 s. - Full proxy suite and perf suite (downloads, uploads, a 300-request burst): no reconnects.
This was referenced Oct 25, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
With #69, port 2010 came back ~18 s after a customer's network change. Almost all of that was detection:
ServerAliveInterval5 s × 3: silence before the session is droppedConnectionMonitorTasknoticing (every 2 s)What changed
ServerAliveInterval2 s × 3. A session that hears nothing from the server for ~6 s is dead. The server answers every keepalive at once, so a healthy connection, busy or idle, is never that quiet.MAX_RETRIES30 → 75 keeps the ~150 s before the tunnel is rebuilt.Tests
mvn test: 1042 tests, 0 failures.The trade-off is deliberate: a network that is completely silent for 6 s or more (a Wi-Fi handover, for example) now gets a reconnect, about 1 s. Before, it got either 15 s of silence followed by the same reconnect, or a session that recovered by itself.