Skip to content

fix: end a stopped execute's pending navigation so later executes don't hang - #239

Merged
thdxr merged 3 commits into
devfrom
fix/execute-disconnect-cleanup
Nov 12, 2026
Merged

thdxr merged 3 commits into
devfrom
fix/execute-disconnect-cleanup

Conversation

@thdxr

@thdxr thdxr commented Nov 12, 2026

Copy link
Copy Markdown
Member

when an execute was stopped (caller disconnect, timeout, toolbar stop) while page.goto waited on a server that hadn't answered, chromium kept Page.navigate in flight on the tab and queued every renderer-bound command behind it. the next execute's connectOverCDP timed out after 15s, the stop path's own commands hit the 60s extension timeout, and only closing the tab recovered.

the fix:

  • on stop the relay sends Page.stopLoading to the session's tabs (handled browser-side, so it answers while the navigation is pending) before closing the script's browser connection (cli/src/relay.ts onStoppingExecute hook, cli/src/session-manager.ts endStoppedScript).
  • the per-call timeout is now armed before the session's execute lock, so a call queued behind a stopped execute that is still settling answers within its own --timeout-ms (cli/src/session-manager/execution.ts).
  • tests: cli/test/session-manager.test.ts (stop and timeout cancel navigation before abort; a queued call honours its timeout), cli/test/execute-realm-browser.ts (headless chromium: stop during a never-answering goto, next return 1 works fast).

verified end to end with headless chromium: before, the next execute after a killed caller never answered (gave up at 45s); after, ~110ms.

fixes #238

@thdxr
thdxr merged commit fb1e621 into dev Nov 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A caller disconnect during page.goto leaves the execute running and blocks later executes (connectOverCDP times out after <ws connected>)

1 participant