Repository navigation
ensure sendPing onCompleted fires exactly once - #17906
Merged
Merged
Conversation
In SessionOpener.sendPing, onCompleted was never invoked when the ping loop exhausted its retry limit, leaving the restart flow's onRestartComplete unrun: suspendingAndRestarting_ stuck true, RESTART_COMPLETED never fired, and the progress indicator never dismissed. The onFailure path also called onCompleted without marking the loop delivered, so repeated ping failures could invoke onCompleted (and fire RESTART_COMPLETED) multiple times. Make pingDelivered_ a single fire-once guard set on all three exit paths -- success, failure, and retry exhaustion -- so onCompleted runs exactly once. Addresses #17143.
The flag now guards one-time completion across success, failure, and retry-exhaustion paths -- not just a delivered ping -- so completed_ describes its role more accurately. Updates the related comments too.
🍎 macOS Desktop E2E · ARM64✅ All tests passed!
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · macos-26 ARM64 · commit |
gtritchie
approved these changes
Jun 9, 2026
gtritchie
left a comment
Member
There was a problem hiding this comment.
LGTM! Is it worthy of a NEWS entry?
Collaborator
Author
|
I think we can skip NEWS; this is a pretty edge-casey fit and finish sort of change. Belt and suspenders, if you will. |
This was referenced Sep 17, 2026
Restart R silently skips its completion event when the session takes more than ~10s to answer
#18870
Closed
kevinushey
added a commit
that referenced
this pull request
Sep 18, 2026
* wait for a slow restart to answer before giving up on it SessionOpener.sendPing ticked every 200ms and spent one of its 50 retries on every tick, including ticks where a ping was already in flight and nothing was sent. The budget was therefore ~10.2s of wall clock however many pings were actually attempted, and when it ran out the loop marked itself completed -- so the ping that did answer a moment later was discarded by the completed_ guard and ConsoleRestartRCompletedEvent never fired. A ping can stay unanswered for much longer than that: rserver holds an RPC aimed at a session it is still relaunching, and the new session then has to restore the workspace before it services RPCs. A failed ping ended the wait outright too, so the retry that would have reached the new session was never sent. That half dates to #17906, which made onCompleted fire exactly once but also made the first failure terminal, leaving maxRetries unused. Budget the wait in wall-clock time instead (60s), wait for an outstanding ping rather than spending the budget on ticks that send nothing, retry after a failure, and announce the restart whenever a ping answers -- even if the wait already timed out, since an answer means R really is back. onCompleted still runs exactly once. Without the event, Shell leaves the console unfocused with a stale prompt and the Console pane keeps showing the previous R version. The e2e test added in #18858 hit this on Server, where a restart takes 9-11s; it no longer needs to hold the completion ping to keep the event alive. Addresses #18870. * bound how late a timed-out restart ping may announce A ping that answers after the timeout still announces the restart, but only within a 5s grace period: announcing refocuses the console, which would otherwise pull the user away arbitrarily late. Also drop the restartAnnounced_ guard, which one-ping-at-a-time already made unreachable. Addresses #18870.
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
In
SessionOpener.sendPing(), theonCompletedcallback was never invoked when the ping loop exhausted itsmaxRetries. The loop logged a warning and returnedfalsewithout signaling completion, so the restart flow'sonRestartComplete(ApplicationQuit) never ran:suspendingAndRestarting_stayedtruepermanently, suppressing nested restart detection.RestartStatusEvent.RESTART_COMPLETEDwas never fired, leaving listeners in stale state.While re-evaluating, the
onFailurepath had a related defect: it calledonCompletedwithout marking the loop as delivered and kept returningtrue, so repeated ping failures could invokeonCompleted-- and re-fireRESTART_COMPLETED-- multiple times.Fix
Make
pingDelivered_a single fire-once guard, set on all three exit paths (success, failure, retry exhaustion) before invokingonCompleted. This:onCompletedon retry exhaustion so the restart flow always completes.onCompletedfires exactly once across all paths, including the case where a hung in-flight ping returns after exhaustion.Testing
cd src/gwt && ant javac(clean compile).Scheduler-drivenRepeatingCommandagainst a livepingRPC, which is not readily exercised by the GWT unit suite. The retry-exhaustion path triggers only when a ping neither succeeds nor fails for the full retry window, which is difficult to reproduce deterministically.Addresses #17143.