Skip to content

bug: linux: the RTMP socket and the QSV DRM fd leak into child processes (follow-up of #2278) #2305

Closed

Description

@rdoupe

Found while fixing #2278 (the Virtual Camera fd leaked into the recording muxer). Other descriptors that obs-rust holds open, without close-on-exec, while it spawns child processes such as obs-ffmpeg-mux:

  • The RTMP stream socket: shared/happy-eyeballs/hosts/posix/happy-eyeballs-platform.h around line 42 creates it without SOCK_CLOEXEC. A recording started while streaming gives the muxer a copy of the stream's TCP connection, which then outlives the stream in the child until the recording ends.
  • The QSV encoder's DRM fd on Linux: plugins/obs-qsv11/common_utils_linux.cpp.hpp around line 291 opens it without O_CLOEXEC and holds it while encoding. Line 384 is the QSV probe open, with the same flags but short-lived.
  • Failure-path leaks:
    • vaapi_open_display_drm() leaves *fd open when vaGetDisplayDRM() returns NULL;
    • qsv11 has the same pattern around line 297.

Plan

  1. RED:
    • Open each descriptor through the real code path, and assert FD_CLOEXEC. A loopback TCP connection is enough for happy-eyeballs; a temp file or render node, with a skip, for QSV.
    • Spawn a child with os_process_pipe_create(), and assert the descriptor is not in /proc/<child>/fd.
    • Exercise the failure paths and assert no fd is left open.
  2. GREEN: add SOCK_CLOEXEC / O_CLOEXEC, and close on the failure paths.

Activity

  1. added
    bug
    on Oct 25, 2026
  2. rdoupe commented on Oct 25, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: #2305.

  3. added
    ready
    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

Labels

bugready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions