Skip to content

segmentation fault in samtools view 1.19 #1961

Description

@geertvandeweyer

Are you using the latest version of samtools and HTSlib? If not, please specify.

(run samtools --version)

samtools 1.19
Using htslib 1.19
Copyright (C) 2023 Genome Research Ltd.

Samtools compilation details:
Features: build=configure curses=yes
CC: /opt/conda/conda-bld/samtools_1702426945528/_build_env/bin/x86_64-conda-linux-gnu-cc
CPPFLAGS: -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /opt/conda/include
CFLAGS: -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/include -fdebug-prefix-map=/opt/conda/conda-bld/samtools_1702426945528/work=/usr/local/src/conda/samtools-1.19 -fdebug-prefix-map=/opt/conda=/usr/local/src/conda-prefix
LDFLAGS: -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,--allow-shlib-undefined -Wl,-rpath,/opt/conda/lib -Wl,-rpath-link,/opt/conda/lib -L/opt/conda/lib
HTSDIR:
LIBS:
CURSES_LIB: -ltinfow -lncursesw

HTSlib compilation details:
Features: build=configure libcurl=yes S3=yes GCS=yes libdeflate=yes lzma=yes bzip2=yes plugins=yes plugin-path=/opt/conda/libexec/htslib htscodecs=1.6.0
CC: /opt/conda/conda-bld/htslib_1702415411511/_build_env/bin/x86_64-conda-linux-gnu-cc
CPPFLAGS: -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /opt/conda/include
CFLAGS: -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /opt/conda/include -fdebug-prefix-map=/opt/conda/conda-bld/htslib_1702415411511/work=/usr/local/src/conda/htslib-1.19 -fdebug-prefix-map=/opt/conda=/usr/local/src/conda-prefix -fvisibility=hidden
LDFLAGS: -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,--allow-shlib-undefined -Wl,-rpath,/opt/conda/lib -Wl,-rpath-link,/opt/conda/lib -L/opt/conda/lib -fvisibility=hidden -rdynamic

HTSlib URL scheme handlers present:
built-in: preload, data, file
S3 Multipart Upload: s3w, s3w+https, s3w+http
Amazon S3: s3+https, s3+http, s3
Google Cloud Storage: gs+http, gs+https, gs
libcurl: imaps, pop3, gophers, http, smb, gopher, sftp, ftps, imap, smtp, smtps, rtsp, scp, ftp, telnet, mqtt, https, smbs, tftp, pop3s, dict
crypt4gh-needed: crypt4gh
mem: mem

Please describe your environment.

  • OS (run uname -sr on Linux/Mac OS or wmic os get Caption, Version on Windows)

Linux 4.15.0-142-generic (ubuntu 22.04 based docker)

  • machine architecture (run uname -m on Linux/Mac OS or wmic os get OSArchitecture on Windows
    x86_64

  • compiler (run gcc --version or clang --version)

na

Please specify the steps taken to generate the issue, the command you are running and the relevant output.

Running samtools view, for a list of regions results in a segmentation fault (core dumped). It's hard to reproduce but seems to be related to -@ n setting:

this fails: (input bam is WES Data of the GIAB sample), chr.head.bed contains 170 regions on chr19 in hg38.

samtools view -@ 8 -C -T hs38DH.fa -o test.out.bam --write-index -L chr.head.bed wes-199345-i_FINAL_DEDUP_RECAL.bam

  • Removing the "-@ 8" fixes the segmentation fault. any other setting, even "-@ 1" causes the error.
  • Changing output format to/from cram does not help
  • running "samtools view <...> chr19 " first, then the same command on that subset-bam works.
  • less regions in the bed file: works (tested : 160 first lines, 10, 20, 30 last lines)
  • other chromosome region files : work
  • samtools 1.18 : same problem.

I've made a tarball with all data available on S3 : s3://cromwell-aws-cloudformation-templates/shares/samtools.issue.tar.gz

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions