Skip to content

Fix Chrome renderer leak in AIS/ADS-B browser sidecars#60

Merged
AndrewCTF merged 1 commit into
masterfrom
fix/sidecar-chrome-renderer-leak
Jul 25, 2026
Merged

Fix Chrome renderer leak in AIS/ADS-B browser sidecars#60
AndrewCTF merged 1 commit into
masterfrom
fix/sidecar-chrome-renderer-leak

Conversation

@AndrewCTF

Copy link
Copy Markdown
Owner

Summary

The MyShipTracking (:8093) and tar1090 (:8090) headless-browser feeders leaked Chrome renderer processes — one browser context per failed page open — until the host ran out of memory.

Root cause

openPage() creates a browser context + page, then can throw on a failed open (site blocked, goto/waitForApi timeout). It threw without closing the context it had just created, so that context's renderer processes stayed orphaned on the browser. The AIS feeder reloads every ~30s while MyShipTracking blocks the sidecar, so each stalled cycle leaked ~1-2 renderers.

Impact (measured live)

  • 496 orphaned Chrome renderers (459 AIS + 36 ADS-B) after ~1h40m.
  • Held tens of GB; MemAvailable down to 35 GB and falling, swap 50% used — heading for OOM.

Fix

Close the context on any failed open before rethrowing (tools/ais-myshiptracking-feeder/index.js, tools/adsb-globe-feeder/index.js). For the shared multi-source ADS-B browser the teardown is scoped to the context so sibling source tabs survive.

Verification

After reclaiming the leaked processes and restarting the backend with the patched feeders:

  • MemAvailable 35 GB → 86 GB (peaked 104 GB right after reclaim).
  • Backend healthy: 10,517 aircraft + 35,199 vessels, feeds green.
  • Renderer count stays bounded at ~49-56 across the observation window under the same blocking condition (AIS :8093 still serving 0 while it retries) that previously drove it to 496.

The MyShipTracking (:8093) and tar1090 (:8090) feeders open a browser
context per page load, but openPage() threw on a failed open (blocked
site, goto/waitForApi timeout) without closing the context it had just
created. Each stalled reload — every ~30s while MyShipTracking blocks the
sidecar — orphaned that context's renderer processes on the browser.

Measured 496 leaked Chrome renderers (459 AIS + 36 ADS-B) holding tens of
GB after ~1h40m, driving the host toward OOM.

Close the context on any failed open before rethrowing. For the shared
multi-source ADS-B browser the teardown is scoped to the context so
sibling tabs survive. Renderer count now stays bounded (~50) under the
same blocking condition instead of climbing without limit.
@AndrewCTF
AndrewCTF merged commit 2ff71f9 into master Jul 25, 2026
2 checks passed
@AndrewCTF
AndrewCTF deleted the fix/sidecar-chrome-renderer-leak branch July 25, 2026 07:26
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