amplab/snap

segfault: OpenMemoryMappedFile datatest/OverflowTable mmap failed: Invalid argument

mr-c opened this issue · 5 comments

mr-c commented

Hello, while updating the snap-aligner package to version 1.0.0 I've run into a segfault running a test:

snap-aligner single datatest datatest.fq -o output.sam
Welcome to SNAP version 1.0.0.

Loading index from directory... snap-aligner: OpenMemoryMappedFile datatest/OverflowTable mmap failed: Invalid argument
debian/tests/run-unit-test: line 37: 3913446 Segmentation fault      (core dumped) snap-aligner single datatest datatest.fq -o output.sam
Core was generated by `snap-aligner single datatest datatest.fq -o output.sam'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000055a729889ec4 in AdviseMemoryMappedFilePrefetch (mappedFile=0x0) at SNAPLib/Compat.cpp:1602

1602	  if (madvise(mappedFile->map, mappedFile->length, MADV_SEQUENTIAL)) {
(gdb) bt
#0  0x000055a729889ec4 in AdviseMemoryMappedFilePrefetch (mappedFile=0x0) at SNAPLib/Compat.cpp:1602
#1  0x000055a72989970d in GenericFile_map::prefetch (this=0x55a729c5c370) at SNAPLib/GenericFile_map.cpp:61
#2  0x000055a72989d68c in GenomeIndex::loadFromDirectory (directoryName=0x7ffcdfe1d04a "datatest", map=<optimized out>, prefetch=<optimized out>) at SNAPLib/GenomeIndex.cpp:1791
#3  0x000055a72986d1a0 in AlignerContext::initialize (this=0x7ffcdfc1b610) at SNAPLib/AlignerContext.cpp:211
#4  0x000055a72986e994 in AlignerContext::runAlignment (this=0x7ffcdfc1b610, argc=5, argv=<optimized out>, version=<optimized out>, argsConsumed=0x7ffcdfc1b60c) at SNAPLib/AlignerContext.cpp:101
#5  0x000055a729888ba4 in ProcessNonDaemonCommands (argc=6, argv=0x7ffcdfe1ba48) at SNAPLib/CommandProcessor.cpp:67
#6  0x000055a72986b069 in main (argc=<optimized out>, argv=<optimized out>) at apps/snap/Main.cpp:32

Here's the complete build log with Debian package versions and exact compilation flags used: https://gist.github.com/mr-c/c8b4c61d511a80bfcae7bef65fde105e

Thanks for reporting this. I pushed a fix to the affineGap branch. Could you please try it out and let me know if it works for you ?

--Arun

mr-c commented

Dear @arun-sub ; that worked, thanks! I've just upload snap-aligner v1.0.0 to Debian's development distribution with your patch.

I merged the changes to master, so you can pull the latest commit with the fix as well.

mr-c commented

Thanks all, I think this issue has been resolved!