Skip to content

fix(browser): evict stuck pages before Playwright connection#1

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

fix(browser): evict stuck pages before Playwright connection#1
Milofax merged 1 commit intodeployfrom
fix/issue-104-browser-timeout-stuck-pages

Conversation

@Milofax
Copy link
Copy Markdown
Owner

@Milofax Milofax commented Feb 12, 2026

Summary

  • Pre-connection health check probes each browser page via raw CDP Runtime.evaluate("1") and closes pages whose renderer doesn't respond within 3s
  • Prevents connectOverCDP() from hanging indefinitely when a tab with heavy JS (e.g. TradingView charting) is open
  • Best-effort only: wrapped in .catch(() => {}), falls back to existing retry logic if eviction fails

Closes Milofax/marakanda-infrastructure#104

Root cause

Playwright's connectOverCDP() attaches to ALL open pages during initialization. If any page's renderer is stuck, the entire connection hangs. Confirmed by closing the stuck tab via raw CDP — Playwright then connected in 63ms.

Test plan

  • npm run build passes (verified locally)
  • Deploy to Mac Mini, open a heavy page (TradingView), then run snapshot — should succeed instead of timing out
  • Regression: tabs, open, status commands still work as before
  • Normal pages (no stuck renderer) are not affected by the health check

🤖 Generated with Claude Code

…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.
@Milofax Milofax merged commit ca50497 into deploy Feb 12, 2026
8 of 12 checks passed
Milofax added a commit that referenced this pull request Feb 18, 2026
After a gateway restart, Chrome's SingletonLock/SingletonSocket/SingletonCookie
files persist on the Docker volume while their /tmp targets are gone. This
causes Chrome to hang or timeout on subsequent launches.

Remove these files in launchOpenClawChrome() before spawning, which is safe
because ensurePortAvailable() already confirmed no Chrome is running on that
port.

Closes openclaw#55

Co-authored-by: Claude Opus 4.5 <[email protected]>
Milofax added a commit that referenced this pull request Feb 18, 2026
…loses openclaw#104) (#1)

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.
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