Skip to content

bug: libobs/util: os_process_pipe_write reports discarded data as written after EPIPE (POSIX) #264

Closed

Description

@b7216309-jpg

os_process_pipe_write in libobs/util/pipe-posix.c keeps calling fwrite until it returns 0. After a failed write, glibc's fwrite copies data into the stdio buffer, fails the flush, discards the buffer and still returns the copied count, 4096 bytes at a time. So once the child's stdin is gone, the function returns the full length, while only the kernel's first partial write (at most one pipe's worth, 64 KiB) was accepted, and nobody read it.

Impact: the frontend blocks SIGPIPE, so writes to a dead child fail with EPIPE instead of killing OBS. plugins/obs-ffmpeg/obs-ffmpeg-mux.c writes every recorded packet to ffmpeg-mux through this function and only checks ret != size. If ffmpeg-mux dies mid-recording, OBS keeps "recording" and discards everything, with no failure signalled until stop.

Found while investigating #192; details and the syscall trace are on #192. Windows (pipe-windows.c) does one WriteFile per call and is not affected; neither is the Rust port.

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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions