Skip to content

Make Chrome tab/session handling more robust (leaks, crashes, concurrency edge cases) #9

Description

@aplgr

Goal

Improve renderer stability under concurrency: prevent leaks, handle crashes, and avoid “stuck” Chrome sessions.

Why

Headless Chrome is powerful but brittle at scale. Most production issues will be lifecycle + concurrency related.

Scope

  • Ensure every request reliably:
    • creates/borrows a page/session
    • closes it on success and on every error path
    • respects context cancellation
  • Add safeguards:
    • max concurrent pages
    • watchdog: restart browser on repeated failures
    • detect and recover from “Chrome died” mid-request
  • Add lightweight instrumentation:
    • counters for active pages
    • render duration histogram (if metrics exist)

Acceptance criteria

  • No steady growth in goroutines / memory under sustained load test
  • Renderer survives Chrome crash (auto-recover within a bounded time)
  • Concurrency limits are enforced (fails fast with 503/429 instead of melting)

Notes / hints

Pair this with the improved load test issue so you can validate fixes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions