Skip to content

Preserve bounded BAM stream errors without pipe seek failures - #111

Merged
iskandr merged 1 commit into
mainfrom
fix/106-bam-pipe-lifetime
Oct 3, 2026
Merged

iskandr merged 1 commit into
mainfrom
fix/106-bam-pipe-lifetime

Conversation

@iskandr

@iskandr iskandr commented Oct 3, 2026

Copy link
Copy Markdown
Owner

A Sid ONT partner-query timeout interrupted a buffered BAM header. Pysam then raised an unraisable Illegal seek error while destroying its partially constructed AlignmentFile on the pipe. An offline producer that flushes a partial BGZF header and stalls reproduces the same cleanup failure.

Read the forward-only BAM framing through Python's gzip reader and copy original header/record blocks to a local BGZF file. This avoids constructing AlignmentFile on a pipe and preserves stored SEQ, QUAL, CIGAR, tag widths and float payloads. Keep the process deadline, overflow cap, stderr, and kill/reap cleanup; truncated streams and nonzero producers still fail without publishing a partial derivative. Version: 0.15.4.

Validation: ruff and all 412 tests passed. New regressions exercise large headers, mid-header timeouts with no unraisable cleanup error, exact record multiplicities after success, overflow, truncated compressed/record blocks, nonzero exit with stderr, and successful acquisition after failure. This fixes the secondary cleanup exception; it does not claim to fix slow remote queries.

Fixes #106. Related: openvax/isovar#436.

@iskandr
iskandr merged commit d0f59c7 into main Oct 3, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate pysam pipe close error during bounded remote BAM extraction

1 participant