Skip to content

bwa-mem2.avx2 crashes (SIGSEGV) on Intel Core Ultra (Arrow Lake) under WSL2 — workaround: force SSE4.2 binary #2254

Description

@pn-pierre-joubert

Description of the bug

BWAMEM2_MEM consistently crashes mid-run with exit code 1. The last line of .command.err is always:

samtools sort: truncated file. Aborting

bwa-mem2 itself exits silently without any error message. dmesg reveals the true cause — repeated SIGSEGV in bwa-mem2.avx2 at a consistent code offset:

bwa-mem2.avx2[...]: segfault at ... ip 00005eb590639d46 sp ... error 4 in bwa-mem2.avx2[5eb59061d000+2d000] likely on CPU 5 (core 5, socket 0)
bwa-mem2.avx2: bwa-mem2.avx2: potentially unexpected fatal signal 11.
WSL (... - CaptureCrash): Capturing crash for pid: ..., executable: !opt!conda!bin!bwa-mem2.avx2, signal: 11

This crash was reproduced across multiple runs, always at the same binary offset (~0x1cd46), on different CPU cores, ruling out transient hardware faults.

Root cause: The bwa-mem2 launcher detects AVX2 support and exec's bwa-mem2.avx2. On Intel Arrow Lake (Core Ultra 200S series), the P-cores (Lion Cove) have a significantly redesigned AVX2 microarchitecture versus previous generations. The bioconda-built bwa-mem2.avx2 binary appears to trigger an illegal memory access on this architecture, particularly under WSL2's Hyper-V virtualization. This is not an OOM issue — dmesg shows no OOM events at this CPU count, and memory usage remained well within limits.


Workaround

Build a custom Docker image that bypasses the auto-detecting launcher and calls bwa-mem2.sse42 directly:

FROM community.wave.seqera.io/library/bwa-mem2_htslib_samtools:e1f420694f8e42bd

RUN mv /opt/conda/bin/bwa-mem2 /opt/conda/bin/bwa-mem2.launcher \
    && printf '#!/bin/sh\nexec /opt/conda/bin/bwa-mem2.sse42 "$@"\n' > /opt/conda/bin/bwa-mem2 \
    && chmod +x /opt/conda/bin/bwa-mem2

Then override the container and tag it so Nextflow resolves it locally (given docker.registry = 'quay.io' in the pipeline config):

// custom.config
process {
    withName: 'BWAMEM2_MEM' {
        container = 'bwa-mem2_htslib_samtools_sse42'
    }
}
docker build -t bwa-mem2_htslib_samtools_sse42 .
docker tag bwa-mem2_htslib_samtools_sse42 quay.io/bwa-mem2_htslib_samtools_sse42
nextflow run nf-core/sarek ... -c custom.config

Suggested improvements

  1. Document this as a known incompatibility for Arrow Lake CPUs and/or WSL2 environments in the troubleshooting guide.
  2. Consider exposing a parameter (e.g. params.bwa_mem2_simd) or a config example that allows users to substitute a custom bwa-mem2 container without patching the pipeline — the current container override via withName works but requires knowing to tag under quay.io/ to avoid the registry prepend.
  3. The issue likely also affects other recent Intel microarchitectures. It may be worth opening a corresponding issue in the bwa-mem2 or bioconda-recipes repositories to get the AVX2 binary recompiled/tested against Arrow Lake.

Command used and terminal output

nextflow run nf-core/sarek \
    --input samplesheet.csv \
    --outdir results \
    --tools strelka,vep \
    --genome GATK.GRCh38 \
    -profile docker \
    --aligner bwa-mem2

Relevant files

No response

System information

nf-core/sarek 3.9.0
bwa-mem2 2.2.1 (community.wave.seqera.io/library/bwa-mem2_htslib_samtools:e1f420694f8e42bd)
Executor Docker
OS WSL2 — Linux 6.6.87.2-microsoft-standard-WSL2
CPU Intel Core Ultra 9 285K (Arrow Lake / Lion Cove)
Genome GRCh38 (--genome GATK.GRCh38)
Aligner --aligner bwa-mem2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions