Repository navigation
fix: make CDP browser shutdown reentrant - #5626
Merged
Merged
Conversation
Co-authored-by: Artiom Lunev <[email protected]>
artiom
marked this pull request as ready for review
October 19, 2026 14:32
Contributor
Author
|
Current head is ready for review. All applicable CI checks passed, including Chromium, Chrome, Edge, Firefox, WebKit, multi-image tests, lint, formatting, leak checks and CodeQL. The optional Dependabot automerge job was skipped. CodeRabbit and Devin Review reported no actionable findings; no review threads are unresolved. The branch is mergeable and awaits human approval. Local focused tests passed (37); the separately disclosed local full-suite limitation does not apply to the successful CI matrix. |
ashwinsingh2007
approved these changes
Oct 20, 2026
artiom
pushed a commit
that referenced
this pull request
Oct 21, 2026
🤖 I have created a release *beep* *boop* --- ## [2.57.2](v2.57.1...v2.57.2) (2026-10-21) ### Bug Fixes * make CDP browser shutdown reentrant ([#5626](#5626)) ([19841b6](19841b6)) * preserve launch arguments alongside legacy switches ([#5630](#5630)) ([eff44d1](eff44d1)) ### Build System & Runtime * bump Node to 24.22.1 ([#5631](#5631)) ([d2e948c](d2e948c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: browserless-actions-bot[bot] <186328842+browserless-actions-bot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Description
Make
ChromiumCDP.close()safe when acloselistener calls it again. Previously the nested call cleared the browser reference before the outer call removed listeners, causing a null dereference and duplicate close events.Publish one pending shutdown promise before notifying listeners. Re-entrant and concurrent callers await the same underlying shutdown rather than returning early. Capture the browser before scheduling shutdown so an unexpected disconnect cannot erase the reference. Clear the pending promise after completion so later lifecycle calls retain the existing behavior.
Verification
removeAllListenerserror with an actual Chromium instance before the fix.npm run build:tspasses.DEBUG=quiet npx mocha --no-package --timeout 45000 build/browsers/browsers.cdp.spec.js: 37 passing. The regression delays the underlying close to check that the nested caller waits, emits only one close event, and permits repeated close calls after shutdown. Existing socket lifecycle, blocked-navigation and authentication tests pass unchanged.git diff --checkpass.npm testreached 110 passing, then stopped in the Browser scratch directories setup because the separate ChromeCDP binary was unavailable. The full multi-browser suite has not passed locally; Chromium was installed and exercised.No API, credential, or network-policy changes. Shutdown notification now runs in a microtask so the shared promise exists before listeners can re-enter.
Summary by CodeRabbit