Repository navigation
Description
Description
When the browse tool's CDP connection drops (e.g., after a hard navigation via window.location.href or a page that crashes during hydration), the tool prints [browse] Starting server... and spawns a new chrome-headless-shell process — but never kills the previous one.
After several retries, orphaned renderer processes accumulate. Each sits at ~120% CPU spinning on about:blank. In my case, 7 orphaned processes consumed ~840% CPU total, exhausting system resources and crashing my Next.js dev server.
Steps to reproduce
- Start a browse session and navigate to a page that triggers a hard redirect or heavy client-side hydration:
$B goto http://localhost:3111/login $B fill @e2 "[email protected]" $B fill @e4 "password" $B click @e6 # triggers window.location.href = '/' - The login succeeds, but the destination page's JS execution crashes the headless browser tab
- Any subsequent
$Bcommand prints[browse] Starting server...and spawns a new browser - Repeat steps 1-3 — chromium processes accumulate
Observed behavior
Clicked @e6 → now at http://localhost:3111/login
[browse] Starting server...
about:blank
ps aux | grep chrome-headless-shell shows multiple renderer processes, each at ~120% CPU:
chrome-headless-shell --type=renderer ... 120.0%
chrome-headless-shell --type=renderer ... 121.9%
chrome-headless-shell --type=renderer ... 119.6%
chrome-headless-shell --type=renderer ... 143.1%
... (7 total)
Expected behavior
When [browse] Starting server... triggers, the tool should kill any existing chrome-headless-shell processes from previous sessions before spawning a new one. A PID file or process group tracking would prevent orphans.
Workaround
Manually kill orphaned processes:
pkill -f "chrome-headless-shell"Environment
- gstack version: 0.9.5.0
- OS: macOS (Apple Silicon)
- Playwright chromium: chromium_headless_shell-1208
- Trigger: Next.js app with
window.location.hrefredirect + heavy client-side hydration (next/dynamic SSR bailout)
Activity
fix(browse): kill old server before restart to prevent orphaned chrom…
fix: community security + stability fixes (wave 1) (#325)
fix: community security + stability fixes (wave 1) (garrytan#325)
fix(browse): kill old server before restart to prevent orphaned chrom…