Menu

error with re-entrant versions

Help
2007-12-30
2012-09-22
  • Masrur Doostdar

    Masrur Doostdar - 2007-12-30

    Hi,

    i get seg-fault errors using the re-entrant versions of some API-functions (cmd_line_parse_file_r and s3_decode_init_r) in latest version of sphinx 3.7. I need this re-entrant versions since i need 2 decoders in one programm each working with their own config-file.

    To make my error reproducable i just edited some lines in the original main_livedecode.c code using the re-entrant versions of the functions:

    --- main_livedecode.c.orig 2007-12-30 20:14:25.000000000 +0100
    +++ main_livedecode.c 2007-12-30 20:16:01.000000000 +0100
    @@ -221,14 +221,15 @@
    return -1;
    }

    • if (cmd_ln_parse_file(S3_DECODE_ARG_DEFS, argv[1], TRUE)) {
    • cmd_ln_t * cmd_ln;
    • if (cmd_ln_parse_file_r(cmd_ln,S3_DECODE_ARG_DEFS, argv[1], TRUE)) {
      printf("Bad arguments file (%s).\n", argv[1]);
      return -1;
      }

      fe = fe_init_auto();

    • if (s3_decode_init(&decoder)) {

    • if (s3_decode_init_r(&decoder,cmd_ln)) {
      printf("Initialization failed.\n");
      return -1;
      }

    With this I get a Seg-Fault:

    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread -1209018160 (LWP 10490)]
    lookup (h=0xbf89f8b6, hash=75733453, key=0x6b35ad "-mdef", len=5)
    at hash_table.c:290
    290 if (entry->key == NULL)
    (gdb) bt

    0 lookup (h=0xbf89f8b6, hash=75733453, key=0x6b35ad "-mdef", len=5)

    at hash_table.c:290
    

    1 0x0013f7ef in enter (h=0xbf89f8b6, hash=75733453, key=0x6b35ad "-mdef",

    len=5, val=0x9d07358, replace=0) at hash_table.c:354
    

    2 0x0013d6dd in cmd_ln_parse_r (inout_cmdln=0xbf89ef94,

    defn=<value optimized out>, argc=41, argv=0x9d067b0, strict=1)
    at cmd_ln.c:500
    

    3 0x0013dcd2 in cmd_ln_parse_file_r (inout_cmdln=0xbf89ef94, defn=0x804a580,

    filename=0xbf89f8f6 "/home/robocup/RCSoftX/res/speech/train/eval/comp_data/live_nav_fsg.arg", strict=1) at cmd_ln.c:670
    

    4 0x08048cc0 in main (argc=1701080365, argv=0xbf89ef94)

    at main_livedecode.c:225
    

    besides my configuration (cfg-file, dictionary ...) is the same as postet here:
    https://sourceforge.net/forum/message.php?msg_id=4642739
    needless to mention, that i get no error with this cfg-file when using original main_livedecode.c file.

    Regars and happy new year

     
    • Nickolay V. Shmyrev

      Hm, I suppose you are incorrectly using the API here. We need a more clear version on how to work in list. The result of this function is not returned in the first argument but returned as a value. Moreover, first argument must be initialized to be a proper list, say must be NULL. So try this version instead:

      • if (cmd_ln_parse_file(S3_DECODE_ARG_DEFS, argv[1], TRUE)) {
      • cmd_ln_t * cmd_ln = NULL;
      • if ((cmd_ln = cmd_ln_parse_file_r(cmd_ln,S3_DECODE_ARG_DEFS, argv[1], TRUE)) == NULL) {
       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.