Skip to content

envoy-browser rig: screenshots degrade under Brave memory/process accumulation (root-caused, not 'flaky') #85

Description

@amiller

Operator: 'flaky' is not acceptable — root-cause and fix it. DONE root-causing; here's the full diagnosis so this is a mechanical fix, not a re-investigation.

Root cause (empirically established, NOT random)

The envoy-browser container runs a single long-lived Brave that ACCUMULATES memory + processes across navigations, and screenshot capture degrades as it does:

  • fresh (post-restart): ~1.2 GB / 15 procs → screenshot OK
  • after ~5 navigations: ~2.7 GB / 24 procs → screenshot timeout
  • saturated: ~10 GB / 19+ procs (hits the container's 10 GB cap) → 'Failed to capture tab: image readback failed', then Brave goes FATAL

Proven: a single screenshot on fresh Brave succeeds with the current flags; the SAME capture fails once accumulated. So it is resource accumulation, not flag-level breakage and not randomness. The 24 procs for ~5 sites strongly suggests the bridge opens a NEW TAB per navigate and never closes them (tab/renderer leak) rather than reusing one target.

The blocker (why a quick fix didn't land)

Brave's launch flags live in /etc/neko/supervisord/brave.conf which is read-only in the running container (baked into the image; sed rename = 'Device or resource busy', cat-redirect = 'Read-only file system'). So --renderer-process-limit cannot be added to the live container — it needs an image rebuild.

Fixes, most-durable first

  1. Image rebuild (envoy-browser / browser-box image): add --renderer-process-limit=4; keep --disable-gpu; TEST whether --disable-software-rasterizer should be dropped (paired with --disable-gpu it leaves no rasterizer, though fresh capture works — memory is the primary driver, but verify).
  2. Bridge tab hygiene: make navigate REUSE a single target (Page.navigate on the same tab) or close prior tabs, so procs don't accumulate. This is likely the real leak (24 procs / 5 sites).
  3. Operational mitigation ALREADY APPLIED: zed:~/paseo-batch/journeys/apps-evidence.sh now restarts Brave fresh at the start of each walk. It helps but a single walk still accumulates enough to fail late captures — insufficient alone; item 1 or 2 is the fix.
  4. Architectural answer: RFC 0028 browser pool (RFC 0028: Browser Runtime & Render Pool #65/RFC 0028: browser render pool (isolated/fair/reset leases) #68) — ephemeral, reset, memory-capped per-lease browsers — is the real long-term fix; this rig is the exact case for it.

Acceptance

Three consecutive scheduled /journeys walks each produce 5 real PASS (screenshots present, not OK-NOSHOT/FAIL), with Brave RSS staying under ~3 GB across a full walk. Screenshot the /journeys apps section showing 5 LIVE ✓ with real captures.

Operator steps

Needs write access to the envoy-browser image source (browser-box/envoy repo) to rebuild + redeploy the rig container.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedBlocked on a dependencybugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions