walaj / SeqLib

C++ htslib/bwa-mem/fermi interface for interrogating sequence data
http://bioinformatics.oxfordjournals.org/content/early/2016/12/21/bioinformatics.btw741.full.pdf+html
Other
133 stars 36 forks source link

malloc(): smallbin double linked list corrupted #29

Closed rwdavies closed 6 years ago

rwdavies commented 6 years ago

Hey,

I have high coverage long read WGS. I'm running code like the following, and getting an error like show below. The weird thing is that while I can reproducibly associate it with a specific read when I run my code per-chromosome, the code runs over the read in question when I run the program over a specific region. Any advice? This is using the most recent version of SeqLib (e0daf6010c4f006523e8e11e12c748c3dbcc7aa7)

Thanks, Robbie

SeqLib::BamReader reader;
// stuff
SeqLib::BamRecord record;
while(reader.GetNextRecord(record)) { <--- error occurs here
 // stuff
}

code around here https://github.com/rwdavies/STITCH/blob/master/STITCH/src/bam_access.cpp#L178

*** glibc detected *** /apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/bin/exec/R: malloc(): smallbin double linked list corrupted: 0x0000000003c63a20 ***
======= Backtrace: =========
/lib64/libc.so.6[0x3b16a75f3e]
/lib64/libc.so.6[0x3b16a7a608]
/lib64/libc.so.6(__libc_malloc+0x5c)[0x3b16a7abfc]
/apps/well/gcc/5.4.0/lib64/libstdc++.so.6(_Znwm+0x18)[0x7f09a78962c8]
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_ZN9__gnu_cxx13new_allocatorISt19_Sp_counted_deleterIP6bam1_tN6SeqLib11free_deleteESaIvELNS_12_Lock_policyE2EEE8allocateEmPKv+0x49)[0x7f09a757ea5f]
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_ZNSt16allocator_traitsISaISt19_Sp_counted_deleterIP6bam1_tN6SeqLib11free_deleteESaIvELN9__gnu_cxx12_Lock_policyE2EEEE8allocateERS9_m+0x28)[0x7f09a757e651]
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_ZSt18__allocate_guardedISaISt19_Sp_counted_deleterIP6bam1_tN6SeqLib11free_deleteESaIvELN9__gnu_cxx12_Lock_policyE2EEEESt15__allocated_ptrIT_ERSB_+0x21)[0x7f09a757e07a]
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC1IP6bam1_tN6SeqLib11free_deleteESaIvEEET_T0_T1_+0x42)[0x7f09a757d50e]   
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC1IP6bam1_tN6SeqLib11free_deleteEEET_T0_+0x32)[0x7f09a757c6b4]
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_ZNSt12__shared_ptrI6bam1_tLN9__gnu_cxx12_Lock_policyE2EEC2IS0_N6SeqLib11free_deleteEEEPT_T0_+0x37)[0x7f09a757b945]
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_ZNSt10shared_ptrI6bam1_tEC2IS0_N6SeqLib11free_deleteEEEPT_T0_+0x28)[0x7f09a757b050]
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_ZN6SeqLib9BamRecord6assignEP6bam1_t+0x28)[0x7f09a7576566]
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_ZN6SeqLib4_Bam9load_readERNS_9BamRecordE+0x1dd)[0x7f09a756ed93]
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_ZN6SeqLib9BamReader13GetNextRecordERNS_9BamRecordE+0x11a)[0x7f09a756e58e]
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_Z31get_sampleReadsRaw_using_SeqLibbiiSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EES7_iS_IiSaIiEES5_S5_S5_+0x453)[0x7f09a754a8c3]
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_Z30get_sampleReadsRaw_from_SeqLibbiiSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EES7_iS_IiSaIiEES5_S5_S5_+0x405)[0x7f09a7551855]
/gpfs0/users/flint/rwdavies/R/x86_64-pc-linux-gnu-library/3.3/STITCH/libs/STITCH.so(_STITCH_get_sampleReadsRaw_from_SeqLib+0x667)[0x7f09a753f8a7]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0xdb872)[0x7f09aaaae872]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0xe6660)[0x7f09aaab9660]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x83b)[0x7f09aaaf1be8]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x12220f)[0x7f09aaaf520f]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x62a)[0x7f09aaaf19d7]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_applyClosure+0x6f9)[0x7f09aaaf2ce4]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x94e)[0x7f09aaaf1cfb]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x1231bb)[0x7f09aaaf61bb]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x62a)[0x7f09aaaf19d7]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x12220f)[0x7f09aaaf520f]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x62a)[0x7f09aaaf19d7]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_applyClosure+0x6f9)[0x7f09aaaf2ce4]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x94e)[0x7f09aaaf1cfb]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x12220f)[0x7f09aaaf520f]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x62a)[0x7f09aaaf19d7]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x121b52)[0x7f09aaaf4b52]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x62a)[0x7f09aaaf19d7]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x12220f)[0x7f09aaaf520f]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x62a)[0x7f09aaaf19d7]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_applyClosure+0x6f9)[0x7f09aaaf2ce4]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(R_forceAndCall+0x516)[0x7f09aaaf36e9]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x74863)[0x7f09aaa47863]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x174ace)[0x7f09aab47ace]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x12dffc)[0x7f09aab00ffc]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x253)[0x7f09aaaf1600]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_applyClosure+0x6f9)[0x7f09aaaf2ce4]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x12da09)[0x7f09aab00a09]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x253)[0x7f09aaaf1600]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_applyClosure+0x6f9)[0x7f09aaaf2ce4]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x94e)[0x7f09aaaf1cfb]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x1231bb)[0x7f09aaaf61bb]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x62a)[0x7f09aaaf19d7]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x12220f)[0x7f09aaaf520f]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x62a)[0x7f09aaaf19d7]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x1211b6)[0x7f09aaaf41b6]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x62a)[0x7f09aaaf19d7]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(+0x12220f)[0x7f09aaaf520f]
/apps/well/R/3.3.2-openblas-0.2.18-omp-gcc5.4.0/lib64/R/lib/libR.so(Rf_eval+0x62a)[0x7f09aaaf19d7]
rwdavies commented 6 years ago

Several hours of debugging later I found out it was a separate error in my code and not SeqLib related, but caused by an out of bounds vector assignment that only manifest itself later on. Sorry for the false bug report!