Skip to content

Investigate pysam pipe close error during bounded remote BAM extraction #106

Closed

Description

@iskandr

During Isovar's catalogue-wide SV RNA audit, bounded remote BAM extraction emits an unraisable pysam close error while handling a record-limit exception:

osteosarc.errors.RecordLimitError: Acquisition exceeds record limit
During handling of the above exception, another exception occurred:
OSError: [Errno 29] Closing failed: Illegal seek
Exception ignored in: 'pysam.libcalignmentfile.AlignmentFile.__dealloc__'
  File "osteosarc/reads.py", line 251, in _run_bounded
    with pysam.AlignmentFile(process.stdout, "rb") as bam:
OSError: [Errno 29] Closing failed: Illegal seek

Observed with released osteosarc 0.15.1, Python 3.12 on macOS, indexed remote RNA BAMs, max_records=500000, and nested batch retries after a record cap. The record-cap handling continues, but the close diagnostic is noisy and its interaction with timer-driven process termination should be checked. A separate leaf acquisition returned CalledProcessError after a truncated BGZF read; the current Isovar receipt records the error class/command but does not preserve the subprocess stderr, so these observations should not be assumed to have the same cause.

Public source in the affected pilot:
https://sid-sijbrandij-osteosarc-dataset.s3.us-west-2.amazonaws.com/kamil/tumor/output/T2/outs/per_sample_outs/T2/sample_alignments.bam

Related implementation and reproducible frozen region plan: openvax/isovar#433 (batch e11a46eac1e8c5e207fcf974, recursively partitioned). Add a pipe/timeout/early-record-cap regression that verifies the primary exception survives cleanup and no partial BAM is published.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions