I'm performing text alignment on a number of utterances in a loop. After about 30 utterances, alignment fails due to a failed assert.
This is what happens:
I call ps_search_finish at the end of an utterance.
Within state_align_search_finish, hmm_out_history(final_phone) returns 0xFFFF.
state_align_search_finish then calls ps_alignment_iter_goto, which returns NULL because pos >= itor->vec->n_ent
Thus, assert(itor != NULL); fails.
In every loop, I create a new alignment structure and a new search structure. The strange thing is that the first ~30 utterances are aligned just fine.
I'm happy to supply any additional information.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did some more digging. Here's a screenshot of the code where the error occurs. You'll note that n_phones is 5.
The following screenshot shows the first 5 entries of sas->hmms. The last entry (#4) is what final_phone points to. You'll notice that for this entry, out_history is -1. This value is then assigned to cur.id. This means that in line 224, the array index is out of bounds and returns garbage.
So the question is: Why is finalPhone->out_history == -1?
I followed your advice and ran valgrind. I've attached the log, but it's not very helpful. It says that there is an "invalid read" in line 224. That's exactly the out-of-bounds array access I described above.
Valgrind doesn't seem to find any problems before that. So that means that the -1 in out_history is probably not because of memory corruption.
-1 means that the final phone was never reached. So probably the search should fail early here, not proceed further. It looks like a bug then, let me check.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm performing text alignment on a number of utterances in a loop. After about 30 utterances, alignment fails due to a failed assert.
This is what happens:
ps_search_finish
at the end of an utterance.state_align_search_finish
,hmm_out_history(final_phone)
returns 0xFFFF.state_align_search_finish
then callsps_alignment_iter_goto
, which returnsNULL
becausepos >= itor->vec->n_ent
assert(itor != NULL);
fails.In every loop, I create a new alignment structure and a new search structure. The strange thing is that the first ~30 utterances are aligned just fine.
I'm happy to supply any additional information.
Maybe there is a memory corruption, try to run under valgrind.
I spent the last hour with gflags (valgrind for Windows). It doesn't appear to be memory corruption.
The failed assert reproducably occurs at a the same point in execution. Is there any information I can supply that might help solve the problem?
I did some more digging. Here's a screenshot of the code where the error occurs. You'll note that
n_phones
is 5.The following screenshot shows the first 5 entries of
sas->hmms
. The last entry (#4) is whatfinal_phone
points to. You'll notice that for this entry,out_history
is -1. This value is then assigned tocur.id
. This means that in line 224, the array index is out of bounds and returns garbage.So the question is: Why is
finalPhone->out_history
== -1?I followed your advice and ran valgrind. I've attached the log, but it's not very helpful. It says that there is an "invalid read" in line 224. That's exactly the out-of-bounds array access I described above.
Valgrind doesn't seem to find any problems before that. So that means that the -1 in
out_history
is probably not because of memory corruption.I'd appreciate any help!
-1 means that the final phone was never reached. So probably the search should fail early here, not proceed further. It looks like a bug then, let me check.
Yeah, it is simply a bug. It should check for
last.id
, not forlast.score
. I've just committed a fix, please update.That's great news. I was afraid it might be something harder to find. Thanks a lot, Nickolay!