Skip to content

fix(browser): evict stuck pages on cached connections too#2

Merged
Milofax merged 2 commits intodeployfrom
fix/issue-104-browser-timeout-stuck-pages
Feb 12, 2026
Merged

fix(browser): evict stuck pages on cached connections too#2
Milofax merged 2 commits intodeployfrom
fix/issue-104-browser-timeout-stuck-pages

Conversation

@Milofax
Copy link
Copy Markdown
Owner

@Milofax Milofax commented Feb 12, 2026

Summary

Follow-up to PR #1 — the eviction only ran during fresh connectOverCDP() calls. When the cached Playwright connection was reused, stuck pages still caused hangs.

Now evictStuckPagesViaCdp() also runs before returning a cached connection.

Verified on Mac Mini:

  • TradingView page renderer is stuck (Runtime.evaluate("1") never responds)
  • After manual eviction: connectOverCDP() succeeds in 7ms
  • This fix applies the same eviction to the cached connection path

Closes Milofax/marakanda-infrastructure#104

…loses openclaw#104)

Playwright's connectOverCDP() attaches to ALL open pages during
initialization. If any page's renderer is stuck (e.g. TradingView with
heavy JS), the entire connection hangs indefinitely.

Add a pre-connection health check that probes each page via raw CDP
Runtime.evaluate("1") and closes unresponsive pages before
connectOverCDP() runs.
The eviction only ran during fresh connectOverCDP() calls. When a cached
Playwright connection was reused, stuck pages (e.g. TradingView with
blocked renderer) would cause page-level operations to hang instead.

Now evictStuckPagesViaCdp() runs before returning the cached connection,
closing any pages whose Runtime.evaluate("1") doesn't respond within 3s.
Playwright auto-removes closed pages via Target.targetDestroyed events.
@Milofax Milofax merged commit edd9795 into deploy Feb 12, 2026
5 of 8 checks passed
Milofax added a commit that referenced this pull request Feb 18, 2026
* fix(browser): evict stuck browser pages before Playwright connection (Closes openclaw#104)

Playwright's connectOverCDP() attaches to ALL open pages during
initialization. If any page's renderer is stuck (e.g. TradingView with
heavy JS), the entire connection hangs indefinitely.

Add a pre-connection health check that probes each page via raw CDP
Runtime.evaluate("1") and closes unresponsive pages before
connectOverCDP() runs.

* fix(browser): run stuck page eviction on cached connections too

The eviction only ran during fresh connectOverCDP() calls. When a cached
Playwright connection was reused, stuck pages (e.g. TradingView with
blocked renderer) would cause page-level operations to hang instead.

Now evictStuckPagesViaCdp() runs before returning the cached connection,
closing any pages whose Runtime.evaluate("1") doesn't respond within 3s.
Playwright auto-removes closed pages via Target.targetDestroyed events.
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.

1 participant