ArtPoon / gotoh2

Lightweight and customizable Python/C extension for pairwise alignment of genetic sequences using the Gotoh algorithm
GNU Affero General Public License v3.0
5 stars 2 forks source link

Calling align() causes crash #5

Closed ArtPoon closed 6 years ago

ArtPoon commented 7 years ago

To reproduce:

>>>from gotoh2.aligner import Aligner
>>>al = Aligner()
>>>al.align('ACGT', 'ACT')  # unit test
my_settings.alphabet = ACGT?
('ACGT', 'AC-T', 13)
>>> al.align('ACGT', 'ACGTTTTTT')
my_settings.alphabet = ACGT?
*** Error in `python': free(): corrupted unsorted chunks: 0x000000000161e5f0 ***
ArtPoon commented 7 years ago

This is really strange. The crash is reproducible by calling align when the second sequence is substantially longer than the first, but reversing the arguments acts fine. What's really odd is that the crash seems to occur after returning from C into Python:

my_settings.alphabet = ACGT?
returned from align()
assigned retval
('A------', 'AAAAAAA', -6)
.
----------------------------------------------------------------------
Ran 3 tests in 0.001s

OK
*** Error in `python': free(): corrupted unsorted chunks: 0x00000000014b5820 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fe8e09667e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x7fe0a)[0x7fe8e096ee0a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fe8e097298c]
ArtPoon commented 7 years ago

Looks like it's probably memory corruption. Installing Valgrind :-/

ArtPoon commented 7 years ago

Valgrind is awesome. Caught a bunch of bit operations outside the memory allocation for bits matrix in edge_assignment. No longer crashes!

ArtPoon commented 6 years ago

Fixing #14 reopened this issue. Rerun Valgrind!

ArtPoon commented 6 years ago

Actually it's not the same problem. Make new issue.