Fix undetected buffered output-write failures - #716
Open
thierrygosselin wants to merge 2 commits into
Open
thierrygosselin wants to merge 2 commits into
thierrygosselin wants to merge 2 commits into
Conversation
Check complete writes and stream errors in the buffered Writer. Report compression and allocation failures explicitly, check fclose errors, and check final flushing of stdout without closing it. This prevents incomplete FASTQ output from being reported as a successful run when an output-write failure occurs.
Test plain FASTQ, single-thread gzip, stdout, and split output. Use a process-specific file-size limit to simulate write failures without filling the disk. Require explicit failure diagnostics and a nonzero exit status. Verify that successful runs preserve the synthetic reads exactly. All eight cases pass with the writer fix. The unmodified Conda 1.3.6 build fails the four write-error cases.
This was referenced Sep 6, 2026
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.
Summary
This PR makes the buffered
Writerfail explicitly when output cannot be written completely.Previously,
writeInternal()accepted any positivefwrite()result as success, callers could ignore a failed write, and final stream errors were unchecked. This could leave truncated output while fastp returned exit status 0.Changes
fclose()errors.The separate multithreaded gzip
pwriteimplementation is unchanged.Regression tests
Added
scripts/test_buffered_output_errors.py, covering plain FASTQ, single-thread gzip, stdout, and split output.The tests use synthetic reads and a process-specific file-size limit to simulate write failures without filling a disk. Reports are directed to
/dev/nullto isolate FASTQ output failures.Run with:
Tested locally on macOS ARM64:
Linux execution and isolated allocation/compression-failure injection have not been tested.