Repository navigation
Conversation
On macOS, a process reading a pipeline's output through a named FIFO can block forever after the command has exited, instead of reading EOF. The spawner now creates anonymous pipes and hands the user process its ends over a Unix socket pair (SCM_RIGHTS). The FIFO paths, their prefix logic (/dev/shm, TMPDIR, /tmp) and their cleanup are removed. Pipe ends in both processes are close-on-exec. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
CI note: the Linux job failed before building anything. In "Install dependencies", |
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Author
|
The rerun (build 12109) hit the same |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On macOS, a process reading a
ProcessPipeline's output through its named FIFO can block forever in its finalread()after the command has exited. The read should return end of file, but it never does. EveryDataSource/DataSinkgoes through the pipeline, even a plaincat file, soSeqReaderandSeqWritercan hang too.In GoldRush this stalls GoldPolish's reaper. Each later batch then leaves a blocked
goldpolish-holdprocess and its spawner, until the per-user process limit (4,000 on macOS) stops all forks. Two chr20 HG002 runs failed this way, after batches 2,052 and 3,015 of about 4,500.Cause
The fault is in macOS's named pipes, not in btllib's logic. A pure C program that copies btllib's FIFO setup and reads the way
SeqReaderdoes (a 16 KiBfread, thenfgetc/ungetcand twogetlinecalls per record) hangs within a few thousand iterations:read()trace shows the first end-of-file read is the one that never returns.cathas exited, and no process holds the write end.The same program with anonymous pipes ran 120,000 iterations without hanging. Ruled out: close-on-exec on the user side, the spawner's SIGCHLD handling, and Python, since a C++ loop hangs too.
Change
The spawner creates anonymous pipes and passes the user process its ends over a Unix socket pair (
SCM_RIGHTS). The FIFO paths, the prefix logic for them (/dev/shm,TMPDIR,/tmp) and their cleanup are removed. Pipe ends are close-on-exec in both processes.Testing
All on macOS 27.0.1, Apple M5, against
masterat da1e843:meson test --repeat=5: 100 of 100 pass.SeqReader: before, 8 of 8 copies stalled within 60 s. After, 8 copies × 50,000 iterations ran without a stall.Not tested on Linux, where the FIFO path never showed the fault. The change removes FIFO-specific code from all platforms, so a Linux CI run is worth checking.
This is separate from #153 (setpgid race); either can merge first.
Related: BirolLab/goldpolish has the same fault in its own named pipes and is fixed separately in BirolLab/goldpolish#36.
Pure C reproducer (run with
FIFO_EOF_FASTA=1 ./fifo_eof file.fa 10000)🤖 Generated with Claude Code