Skip to content

DeepSomatic 1.10.0 make_examples_somatic is OOM-killed on a 25 kb ONT tumor-only region due to unbounded read materialization #1093

Description

@VasLem

make_examples_somatic reproducibly fails with Linux OOM kill on a single 25 kb ONT tumor-only region:
chr16:46375000-46400000

The subset from this bam (available for 7 days) is approximately 1.88 GiB and contains:
135704 alignments from samtools view -c
71477 primary reads from samtools stats
741038496 mapped bases from CIGAR
average read length around 9469
maximum read length 1482710

Environment

Observed with DeepSomatic / DeepVariant 1.10.0.
The make_examples_somatic.zip payload reports:
DEEP_VARIANT_VERSION = '1.10.0'
The DeepVariant image inspected was:
gcr.io/deepvariant-docker/deepvariant:gh1060
Digest:
sha256:960bc2c307f9cbc64a9ae56bb21f62fd3964af1f079397f92bbcbe88cb233122
Relevant command configuration
The failing run uses ONT tumor-only make_examples_somatic with:
--model_type=ONT_TUMOR_ONLY
--regions chr16:46375000-46400000
--num_shards=1
--make_examples_task=0
--steps_to_run=make_examples
--partition_size=25000
--max_reads_per_partition=0
--phase_reads=true
--enable_methylation_calling=true
--track_ref_reads=true
--realign_reads=false
--sort_by_haplotypes=true
--trim_reads_for_pileup=true

Observed behavior

The process logs:
Processing chr16:46374999-46399999
It is then killed by the kernel with exit code 247.
On a 32 GiB machine:
peak memory: 33099112448
cgroup memory event: oom_kill 1
A reproduction using the same 25 kb BAM subset on a 128 GiB high-memory machine also failed:
exit code: 247
peak memory: 133914116096
cgroup memory event: oom_kill 1
No Python exception, Abseil fatal message, or C++ assertion is emitted before the process is killed.
Where the failure appears to occur
The last emitted DeepVariant debug line is the Processing chr16:46374999-46399999 message immediately before RegionProcessor.process(...).
In the shipped make_examples_core.py, the no-realignment path queries reads overlapping the region and then materializes them with list(reads). Read sampling is only applied when max_reads_per_partition > 0 or a dynamic base cap is active.
For this ONT tumor-only configuration, max_reads_per_partition=0, so all reads overlapping the 25 kb interval are materialized. With track_ref_reads=true, the reads are then also passed through allele-counter logic. phase_reads=true and enable_methylation_calling=true both require track_ref_reads=true, so this appears to be a default high-memory path for ONT tumor-only calling in this configuration.

Expected behavior

DeepSomatic should either:
complete processing of the 25 kb region without requiring more than 128 GiB RAM, or
fail early with a clear diagnostic that the region exceeds supported read-count or read-bases limits.

Actual behavior

make_examples_somatic grows memory until the kernel OOM-kills the process, with no actionable DeepVariant/DeepSomatic error message.

Request

Please add a bounded-read or bounded-bases safeguard in make_examples_somatic for ONT tumor-only mode when max_reads_per_partition=0, especially with track_ref_reads, methylation calling, and read phasing enabled.
At minimum, it would be useful for make_examples_somatic to detect this condition before materializing all overlapping reads and emit a clear diagnostic containing the region, read count, total read bases, and the relevant cap/flag settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions