Skip to content

libobs/util: Prevent leaking pipe file descriptors to subprocesses - #10574

Merged
Lain-B merged 1 commit into
obsproject:masterfrom
exeldro:pipe_file_descriptor
Apr 20, 2024
Merged

Lain-B merged 1 commit into
obsproject:masterfrom
exeldro:pipe_file_descriptor

Conversation

@exeldro

@exeldro exeldro commented Apr 19, 2024 •

Copy link
Copy Markdown
Contributor

Description

Set FD_CLOEXEC file descriptor flag for the pipes created by os_process_pipe_create

Motivation and Context

Since #10070 obs-ffmpeg-mux can get in a state that it does not close.
os_process_pipe_destroy waits till the process ends. The obs-ffmpeg-mux process is terminated when an EOF appears on the
pipe. However, forked process hold the file descriptor of the write-end of the pipe, the EOF won't arrive to the obs-ffmpeg-mux process.
Prevent plugins needing code to close all file descriptors like norihiro/obs-command-source@f4e9b26

How Has This Been Tested?

On Mac with the source record plugin

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@kkartaltepe

Copy link
Copy Markdown
Collaborator

Nit, commit message is probably better as Add CLOEXEC to muxer pipes, or Prevent leaking muxer pipes to subprocesses, etc.

Works on linux for ffmpeg av1 in my tests.

@exeldro
exeldro force-pushed the pipe_file_descriptor branch from de87590 to cd6029f Compare April 20, 2024 06:26
@exeldro exeldro changed the title libobs/util: Fix keeping pipe file descriptors libobs/util: Prevent leaking pipe file descriptors to subprocesses Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants