Repository navigation
clear pending session launches when the launched process dies - #18209
Merged
Merged
Conversation
rserver buffers RPCs during a session relaunch (sessionRetryProfile polls the connection every 25ms for up to rsession-proxy-max-wait-secs), but the recovery path had a stuck state: the relaunch was only attempted on the first recovery pass, and SessionManager::launchSession treats any pending launch younger than one minute as in-flight. If the launched process died before a client connection (e.g. it raced a suspending session's exit), nothing re-attempted the launch, so every buffered request burned its full 30s wait and failed with "Unable to connect to service". Track the launched pid on the pending-launch entry and clear the entry from the process tracker's exit handler when that process dies, and re-attempt the launch from the recovery function (throttled to once per second per request) so waiting requests relaunch as soon as the dead launch is cleared. Addresses #18208.
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
RStudio E2E - all platformsAll tests passed!
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
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.
Summary
rserver already buffers proxied RPCs across a session restart:
sessionRetryProfileretries the session connection every 25ms for up torsession-proxy-max-wait-secs(default 30s), relaunching the session on the first failed attempt. But that recovery path had a stuck state, diagnosed from the e2e failure on PR #18203:pendingLaunches_entry behind.SessionManager::launchSessiontreats any pending launch younger than one minute as in-flight, andlaunchSessionRecoveryonly attempted a launch on the first recovery pass -- so nothing ever re-attempted the launch. Every request buffered behind the dead launch burned its full 30s wait and failed withjsonrpc error 1 (Unable to connect to service).removePendingLaunch, which is why the next request after the failures relaunched successfully.Changes:
SessionManagernow records the launched pid on the pending-launch entry (notePendingLaunchPid), and the default launcher registers aChildProcessTrackerexit handler that clears the entry when that process dies before a client connection (removePendingLaunchForPid). The removal is pid-matched so a long-lived session's eventual exit cannot clear a newer pending launch for the same context, and pending launches recorded by custom session launchers (no pid) keep the previous age-based behavior.launchSessionRecoverynow re-attempts the launch on subsequent recovery passes (throttled to once per second per request) instead of only the first, so requests already waiting relaunch as soon as the dead launch is cleared.launchSession's pending-entry check remains the dedupe point.With both pieces, a launch that dies mid-suspend self-heals within about a second instead of stalling every buffered request for 30 seconds.
Testing
ServerSessionManagerTests.cppcovering pending-launch dedupe, pid-matched removal (dead process clears the entry; unrelated pids and unrecorded pids do not).rserver-testssuite passes (39 tests).session_suspend.test.tswedge on this window was fixed separately in fix waitForSessionRestart marker false-pass during session resume #18207; the suspend/resume e2e tests exercise this path in CI.Fixes #18208.