Skip to content

Bug: shutdown after client disconnect can crash on stdout EPIPE from resource-list notifications, orphaning ffmpeg #229

Closed

Description

@TMHSDigital

Why it matters

The disconnect path is exactly when the server must clean up recordings. A crash in the middle of stopAll leaves sessions marked "recording", loses the event-log summary and, if graceful q times out, skips the killPid fallback. ffmpeg then keeps capturing until its cap (default 3600 s).

Evidence

Suggested approach

Set a shuttingDown flag before cleanup and skip notifications once it is set. Add process.stdout.on("error", () => {}) (or route to stderr logging) so a dead pipe can never abort cleanup. Wrap the onChange callback in try/catch.

Done when

A test simulates stdin EOF with stdout closed during an active (mocked) recording; shutdown completes, the session is marked stopped and no uncaught exception is raised.

Activity

  1. added
    bug
    effort: small
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugeffort: smallpriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions