Repository navigation
fix(client): clean up a failed start even when interrupted while closing - #738
Merged
Merged
Conversation
route
force-pushed
the
fix/interrupted-start-cleanup
branch
from
November 27, 2026 16:15
00de1d6 to
c733ba1
Compare
Client#close killed its thread and closed the dispatcher and socket only after waiting up to a second for the thread, so an interrupt landing in that wait (Timeout.timeout, Thread#raise) leaked the threads and the socket. They run in an ensure now. Browser#start also stops the process when closing the client is interrupted.
route
force-pushed
the
fix/interrupted-start-cleanup
branch
from
November 27, 2026 16:40
c733ba1 to
70904d2
Compare
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.
When
Browser.newfails, e.g. a remote Chrome that accepts the WebSocket and never answersBrowser.getVersion,Client#closewaits up to a second for its message thread before it kills the thread and closes the dispatcher and the socket. An interrupt that lands in that second, such as an outerTimeout.timeout,Thread#raise,Thread#killor Ctrl-C, skipped all of it. Every such attempt left 5 threads and an open socket behind, andGC.startdidn't free them. For a browser Ferrum launched,Browser#startalso skipped@process.stop.With
Browser.new(ws_url:, timeout: 1)against an endpoint that never answers:Timeout.timeout(1.5)Thread#raiseat 1.4sThread#killat 1.4sClient#closekills the thread and closes the dispatcher and the socket in anensure.Browser#startstops the process in anensurearound closing the client.