Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert a bug from c1f4b7c where CRAM aux tags were not compressed. #1729

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

jkbonfield
Copy link
Contributor

In an attempt to fix memory leaks during encode of malformed CRAM data, that lead to bailing out early, we attempted to get everything to a uniform state as soon as possible. Specifically s->aux_blocks get migrated to s->blocks earlier, so if we bail out we don't have the decision to make as to which bit of memory needs freeing.

That worked, but unfortunately I forgot that the compression is applied to s->aux_blocks and not s->blocks for auxiliary tags, so moving the blocks earlier gives uncompressed blocks in CRAM. The format is valid and all tests pass, but it's overly large for obvious reasons.

Sadly this is a rather serious bug caused by an attempt to fix a really minor bug.

Fixes samtools/samtools#1968

In an attempt to fix memory leaks during encode of malformed CRAM
data, that lead to bailing out early, we attempted to get everything
to a uniform state as soon as possible.  Specifically s->aux_blocks
get migrated to s->blocks earlier, so if we bail out we don't have the
decision to make as to which bit of memory needs freeing.

That worked, but unfortunately I forgot that the compression is
applied to s->aux_blocks and not s->blocks for auxiliary tags, so
moving the blocks earlier gives uncompressed blocks in CRAM.  The
format is valid and all tests pass, but it's overly large for obvious
reasons.

Sadly this is a rather serious bug caused by an attempt to fix a
really minor bug.

Fixes samtools/samtools#1968
@daviesrob daviesrob merged commit 31e5a5f into samtools:develop Jan 16, 2024
9 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.

Samtools 1.19 bam-cram conversion produce cram bigger than bam
2 participants