broadinstitute / gamgee

A C++14 library for NGS data formats
http://broadinstitute.github.io/gamgee/
MIT License
40 stars 13 forks source link

Segfault in VariantHeaderMerger #396

Closed jmthibault79 closed 10 years ago

jmthibault79 commented 10 years ago

Running a benchmark test for combine_gvcfs with 20 inputs resulted in a segmentation fault due to a failed assert:

merged_vcf_lut.h:231: void gamgee::utils::MergedVCFLUTBase<inputs_2_merged_LUT_is_input_ordered, merged_2_inputs_LUT_is_input_ordered>::set_lut_value(std::vector<std::vector<int> >&, int, int, int) [with bool inputs_2_merged_LUT_is_input_ordered = true; bool merged_2_inputs_LUT_is_input_ordered = true]: Assertion `rowIdx < static_cast<int>(lut.size())' failed.

Program received signal SIGABRT, Aborted.
0x0000003774030265 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x0000003774030265 in raise () from /lib64/libc.so.6
#1  0x0000003774031d10 in abort () from /lib64/libc.so.6
#2  0x0000003774029706 in __assert_fail () from /lib64/libc.so.6
#3  0x00000000006a29ce in gamgee::utils::MergedVCFLUTBase<true, true>::set_lut_value (this=0x7fffffff8ac0, lut=..., rowIdx=10,
    columnIdx=0, value=0)
    at /home/unix/thibault/src/gsa4-foghorn/build/contrib/gamgee-prefix/src/gamgee/gamgee/utils/merged_vcf_lut.h:231
#4  0x00000000006a25fd in gamgee::utils::MergedVCFLUTBase<true, true>::set_merged_idx_for_input<true, (void*)0> (
    this=0x7fffffff8ac0, inputGVCFIdx=10, inputIdx=0, mergedIdx=0)
    at /home/unix/thibault/src/gsa4-foghorn/build/contrib/gamgee-prefix/src/gamgee/gamgee/utils/merged_vcf_lut.h:246
#5  0x00000000006a21a2 in gamgee::utils::MergedVCFLUTBase<true, true>::add_input_merged_idx_pair (this=0x7fffffff8ac0,
    inputGVCFIdx=10, inputIdx=0, mergedIdx=0)
    at /home/unix/thibault/src/gsa4-foghorn/build/contrib/gamgee-prefix/src/gamgee/gamgee/utils/merged_vcf_lut.h:86
#6  0x00000000006a0999 in gamgee::VariantHeaderMerger<true, true, true, true>::add_header_fields_mapping (this=0x7fffffff8ac0,
    curr_header=0xc4e1c0, input_vcf_idx=10)
    at /home/unix/thibault/src/gsa4-foghorn/build/contrib/gamgee-prefix/src/gamgee/gamgee/variant_header_merger.cpp:31
#7  0x00000000006a0301 in gamgee::VariantHeaderMerger<true, true, true, true>::add_header (this=0x7fffffff8ac0, header_ptr=...)
    at /home/unix/thibault/src/gsa4-foghorn/build/contrib/gamgee-prefix/src/gamgee/gamgee/variant_header_merger.cpp:73
#8  0x000000000062dc43 in gamgee::MultipleVariantReader<gamgee::ReferenceBlockSplittingVariantIterator>::init_reader (
    this=0x7fffffff8a90, filenames=..., validate_headers=true)
    at /home/unix/thibault/src/gsa4-foghorn/build/contrib/gamgee-install/include/gamgee/multiple_variant_reader.h:98

11 input VCFs also caused this fault, and 10 inputs did not. So I think the problem lies in a missing resize somewhere from the initial size of 10.

kgururaj commented 10 years ago

Ouch - my bad: https://github.com/broadinstitute/gamgee/pull/397