Repository navigation
Fix stalled tab cleanup and verify target removal - #50
Merged
Merged
Conversation
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.
Stalled CDP calls can permanently strand tracked tabs. Chrome can also acknowledge
Target.closeTargetwhile a navigating target remains alive. Bound cleanup and attachment, and confirm that the target is gone before discarding its tracking record. Refs #39.Track target IDs before tab attachment. Give discovery and WebSocket attachment a five-second deadline, cancel pending HTTP requests/handshakes, and clean up targets when attachment fails.
Use one six-second budget for each cleanup attempt, including concurrent transport teardown. Try the existing session, the HTTP endpoint, then a bounded fresh browser session. Confirm target disappearance rather than trusting a successful close acknowledgement or an HTTP 404.
Join concurrent closes instead of replacing CRI close listeners. Keep unresolved targets tracked and retry with exponential backoff capped at 30 seconds; the reaper respects this backoff.
Isolate cancellable CRI construction and forced transport shutdown in
cdptransport.js. Its internal integration explicitly checks the existing 0.33.3 version, so an unreviewed upgrade fails visibly rather than silently losing cancellation. Internal notes document the recovery behavior and upgrade requirement.Include the new transport adapter in the Docker image so the container can load
cdp.jsat startup.Validation
CI passed on
ee79ea6b53025d01fad1c9e8171358642c84be0c:docker-build (ubuntu-latest)andcompose-e2e. Successful CI run.Local validation used existing dependencies, Node 18.20.4, Chrome 152.0.7977.64, disposable headless profiles, and loopback HTTP/CDP fixtures. No dependencies were installed and no test files are included.
node --check cdp.js,node --check cdptransport.js, adapter import, andgit diff --checkpassed.Manual run commands used temporary verification scripts outside the repository:
Each script launches an isolated Chrome profile with
--headless=new --remote-debugging-address=127.0.0.1 --remote-debugging-port=0 --disable-background-networking --disable-extensions --no-first-run --no-default-browser-check, serves loopback-only fixtures, and stops its own browser afterward. TLS/HTTP fingerprint equality was not measured.