Speech Recognition Engines

Flat
HNet memory crash when saving lattice to ouput file
User: Cedric
Date: 4/26/2013 3:21 pm
Views: 7283
Rating: 3

Hello all,

Whenever I try to build a word network with HBuild or HParse, it
crashes at the very end when saving the network to the output file.
I've used gdb to locate the crash, and the error is a bad memory
access in WriteOneLattice(), at line 594 of HNet.c.

I honestly have no idea what's going on. I use HTK 3.4.1 on Mac OSX
10.7.5. I think HTK has been properly installed: the test in HTKDemo
ran with correct output, and the few other tools I've used haven't
given me such issue.

Below is the log output, content of the input file used, and the gdb backtrace.

----- HBuild log -----

HBuild -A -D -V -T 1 one_wdlist one_wdnet

No HTK Configuration Parameters Set


HTK Version Information
Module     Version    Who    Date      : CVS Info
HBuild     3.4.1      CUED   12/03/09  : $Id: HBuild.c,v 1.1.1.1
2006/10/11 09:54:59 jal58 Exp $
HShell     3.4.1      CUED   12/03/09  : $Id: HShell.c,v 1.1.1.1
2006/10/11 09:54:58 jal58 Exp $
HMem       3.4.1      CUED   12/03/09  : $Id: HMem.c,v 1.1.1.1
2006/10/11 09:54:58 jal58 Exp $
HLabel     3.4.1      CUED   12/03/09  : $Id: HLabel.c,v 1.1.1.1
2006/10/11 09:54:57 jal58 Exp $
HMath      3.4.1      CUED   12/03/09  : $Id: HMath.c,v 1.1.1.1
2006/10/11 09:54:58 jal58 Exp $
HDict      3.4.1      CUED   12/03/09  : $Id: HDict.c,v 1.1.1.1
2006/10/11 09:54:57 jal58 Exp $
HNet       3.4.1      CUED   12/03/09  : $Id: HNet.c,v 1.1.1.1
2006/10/11 09:54:58 jal58 Exp $
HLM        3.4.1      CUED   12/03/09  : $Id: HLM.c,v 1.1.1.1
2006/10/11 09:54:57 jal58 Exp $

Building word loop
Saving lattice to file one_wdnet
Segmentation fault: 11

---- end of HBuild log ----

----- one_wdlist ----
one
---- end of one_wdlist ----

----- gdb run crash details -----

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000000f3ad84c8
0x00000001000463a4 in WriteOneLattice (lat=0x7fff5fbff4f0,
file=0x7fff7b4d9ee0, format=1606415600) at HNet.c:594
594      en=rorder[la->end-lat->lnodes];
(gdb) backtrace
#0  0x00000001000463a4 in WriteOneLattice (lat=0x7fff5fbff4f0,
file=0x7fff7b4d9ee0, format=1606415600) at HNet.c:594
#1  0x0000000100046bf8 in WriteLattice (lat=0x10080be00,
file=0x7fff7b4d9ee0, format=64) at HNet.c:672
#2  0x000000010000252d in SaveLattice (lat=0x10080c180,
latFn=0x7fff5fbff92f "one_wdnet", format=0) at HBuild.c:278
#3  0x0000000100002c93 in main (argc=8438144, argv=0x6666666666666667)
at HBuild.c:249

---- end of gdb run crash details

----- gdb backtrace -----

#0  0x00000001000463a4 in WriteOneLattice (lat=0x7fff5fbff530,
file=0x7fff7b4d9ee0, format=1606415664) at HNet.c:594
#1  0x0000000100046bf8 in WriteLattice (lat=0x10080ae00,
file=0x7fff7b4d9ee0, format=64) at HNet.c:672
#2  0x000000010000252d in SaveLattice (lat=0x10080b180,
latFn=0x7fff5fbff931 "one_wdnet", format=0) at HBuild.c:278
#3  0x0000000100002c93 in main (argc=8434048, argv=0x6666666666666667) at HBuild

---- end of gdb backtrace ----

I hope you will be able to help me as I can't use HTK at all without
this :(.

Thank you in advance,
Cedric

--- (Edited on 4/26/2013 3:21 pm [GMT-0500] by Visitor) ---

Re: HNet memory crash when saving lattice to ouput file
User: barking
Date: 5/23/2013 1:54 am
Views: 300
Rating: 3

me too ...

help help

--- (Edited on 5/23/2013 1:54 am [GMT-0500] by Visitor) ---

Re: HNet memory crash when saving lattice to ouput file
User: Random
Date: 7/18/2013 11:57 pm
Views: 120
Rating: 4

I hit the same issue also when compiling the code on Mac. I am able to isolate the issue and work around it. 

I found that the assembly code generated for NumbLArc is broken. My work around is to change the macro definition to the following function in HNet.c: 

LArc* NumbLArc(Lattice* lat, int n)

{

   if (lat->format & HLAT_SHARC) {

      LArc_S* temp = (LArc_S*)(lat->larcs);

      return (LArc*)&temp[n];

   } else {

      LArc* temp = lat->larcs;

      return &temp[n];

   }

}

 

The function should be equivalent to the macro, and it seems to fix the issue. 

I suspect that this is a compiler bug. My compiler version is:

$ gcc --version

i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

 

Anyway, hope this helps.

 

--- (Edited on 7/18/2013 11:57 pm [GMT-0500] by Visitor) ---

Re: HNet memory crash when saving lattice to ouput file
User: ProductArchitect
Date: 8/5/2013 7:58 pm
Views: 2085
Rating: 3

Thanks much for posting, though unfortunately that didn't fix the problem for me (despite the same gcc version). Was there anything else that you changed?

Or, I'm still running 10.6.8 Snow Leopard on an old MacBook; perhaps the bug & fix vary by configuration.

I haven't coded any C in ages. What's the easiest way to add a diagnostic to make sure the new version got installed and in my path. (The timestamp looks correct so I don't think that's the issue.)

--- (Edited on 8/5/2013 7:58 pm [GMT-0500] by Visitor) ---

PreviousNext