steineggerlab / Metabuli

Metabuli: specific and sensitive metagenomic classification via joint analysis of DNA and amino acid.
GNU General Public License v3.0
118 stars 10 forks source link

Fix segfaults in #10 #11

Closed sjaenick closed 1 year ago

sjaenick commented 1 year ago

I was able to track down the issue underlying the segfaults reported by me in #10; in both cases, wrong mmap() usage was the culprit, assuming that both input as well as database files would always be writable by the user executing Metabuli.

I switched the mapping of the input FASTA file to a readonly mapping, and introduced a new mode = 3 for mmapData with MAP_PRIVATE to be used with database files, so in-memory changes aren't persisted to disk.

jaebeom-kim commented 1 year ago

Thank you so much for deciphering the bug and providing the solutions. Did your implementation solve the SegFault occurring with a single thread, too?

sjaenick commented 1 year ago

Did your implementation solve the SegFault occurring with a single thread, too?

Yes, currently everything works as intended

martin-steinegger commented 1 year ago

@sjaenick Thank you so much for helping. This is amazing work.

jaebeom-kim commented 1 year ago

Did your implementation solve the SegFault occurring with a single thread, too?

Yes, currently everything works as intended

I cloned your Metabuli repo and tested it with a single thread, but it still reports segfaults. I found the bug is around Classifier::getNextTargetKmer() function call. diffBufferIdx became larger than the size of diffIdxBuffer, which is not intended. I'm trying to find the reason.