althonos / pyhmmer

Cython bindings and Python interface to HMMER3.
https://pyhmmer.readthedocs.io
MIT License
125 stars 12 forks source link

`pyhmmer.nhmmer` throws error when the number of FASTA seqs is larger than 64 #62

Closed moshi4 closed 7 months ago

moshi4 commented 7 months ago

Hi @althonos, this is a bug report about pyhmmer.nhmmer.

I encountered an error when entering a multi-fasta in pyhmmer.nhmmer with pybarrnap. After investigating the conditions for reproducing the error, it appears that the error occurs when the number of FASTA seqs is greater than 64. Also, the error contents are not always the same, such as Segmentation fault, corrupted size vs. prev_size, munmap_chunk(): invalid pointer.

You can reproduce the error with the following examples data and commands.

examples.zip

pybarrnap examples/64seqs_success.fa
pybarrnap examples/65seqs_failed.fa
pybarrnap examples/91seqs_failed.fa
althonos commented 7 months ago

Thanks for the report @moshi4,

There was a bug in the way i was computing array reallocation which caused arrays of 64 items to never be reallocated to a larger capacity, which was then causing some out-of-buffer writes and causing various memory issues later.

I fixed the problem, confirmed pybarrnap works properly now, and will push a patch.

althonos commented 7 months ago

Fixed in v0.10.9 :+1: