A daemon whose browser is alive but wedged is reused forever (`meta=ping` is a process probe, not a browser liveness check)

Author: bill-gutterdomeCreated Sep 28, 2026Updated Sep 28, 2026

Summary

meta=ping answers as long as the daemon process is alive, and handle() short-circuits on it before touching the browser (browser_harness/daemon.py:677). already_running() (daemon.py:872) and the orphan reaper (admin.py:382) both trust that reply. So when a daemon's CDP connection stays open but the browser stops answering, every later call through every session name that ever pointed at that daemon hangs, and the failure reads as "the tool hangs" — not "that browser is wedged" and not "that daemon is unusable".

A daemon whose browser has exited is fine (next call respawns it). A daemon whose browser is alive but wedged is not, and nothing at the daemon boundary distinguishes the two for the caller.

Observed failure

Four daemons, one wedged browser (ws://127.0.0.1:42465):

  • each answered meta=ping → already_running() reused them, the orphan reaper left them alone;
  • every real CDP call through them never returned;
  • killing and respawning the browser did not help (the fresh daemons re-attached to the same wedged endpoint), and neither did using a new session name;
  • killing the browser and those daemons restored all four names instantly.

Request trace taken on a reproduction of a wedged daemon (a socket that answers ping and holds every CDP request open forever — what the real daemon does when it is parked in cdp.send_raw while the browser never replies):

[{"meta": "ping"}, {"meta": "ping"},
 {"method": "Target.getTargets"}, {"method": "Target.getTargets"},
 {"meta": "ping"}, {"meta": "ping"},
 {"meta": "shutdown"}, {"meta": "ping"}]

i.e. the CLI pings (trusting the process), issues the real call, burns two 5 s _IPCResponseTimeouts, then tries the meta=shutdown handshake — the one reply a daemon whose browser is wedged can never produce — and finally respawns. On this box that is 28.5 s to a SILENT recovery, and against a genuinely wedged browser the respawn cannot help at all, because the new daemon attaches to the same unresponsive browser.

What would fix it (proposal, daemon-side)

  1. Make the reuse decision browser-aware. meta=ping (or a sibling meta=health) should include a bounded browser round trip — a browser-level call (e.g. Target.getTargets) under a short asyncio.wait_for. If it does not answer, reply {"pong": false, "browser": "unresponsive"} or exit the daemon so the next call respawns it. The daemon must not be reused on a process-only signal.
  2. Bound the CDP dispatch in Daemon.handle (daemon.py:769) so a call that never comes back cannot park a handler forever, and so the daemon can decide to retire itself rather than accept more work.
  3. Do not let meta=shutdown be the recovery path for an unresponsive daemon: it awaits recovery drain and CDP-dependent cleanup, which is exactly what cannot complete. An unresponsive daemon needs termination, not a handshake.

Related upstream work (checked before filing — this is not a duplicate)

  • #372 and #508 both bound CDP request waits (4.5 s / a per-call budget) and #508 explicitly notes send_raw still has no server-side timeout. Those bound how long a call may hang; they do not change the reuse decision, which is what this report is about — a daemon is still re-adopted on a process-only ping.
  • #492 tightens the Target.getTargets probe in ensure_daemon() (descriptor leak on the healthy path), which is the caller side of the same signal.
  • #773 deliberately keeps a live Cloud browser on a failed health probe rather than stopping it. Any fix here must stay compatible with that: retire the daemon on an unresponsive browser, do not stop a browser the daemon does not own. Worth settling the two together, since a naive "kill on unhealthy" would undo #773.

Notes for the caller-side

_cdp_http_ready-style checks (/json/version over HTTP) pass on a wedged-but-alive browser, so a caller cannot screen an endpoint that way either; a real CDP round trip is required there too.

Environment

Linux, browser-use launched via uvx from the uv cache (the live archive path moved between two daemons in the same hour, so this is not a pinned-install artifact), Chrome for Testing driven over CDP with BU_CDP_URL set (BROWSER_KIND == "cdp"). Package browser-harness 0.1.13 (browser_use CLI 0.13.10).

Source: browser-use/browser-harness