Skip to content

[#854] [DEBUG-ONLY] Fix assert failure while issuing %YDB-E-ICUSYMNOTFOUND error using Simple API

Narayanan Iyer requested to merge nars1/YDB:ydb854 into master

Background

  • Below is pasted from #854 (closed)

  • This is something I noticed while running the bats tests in YDBOcto (test_errors/TERR018 subtest where it tests for the ICUSYMNOTFOUND error) using a Debug build of YottaDB r1.34. It assert failed as seen below. The Release build of r1.34 works fine.

    r1.32 Debug build

    $ sh ydb_init.sh
    ydb_init() returned status = 150381514
    ydb_zstatus() returned : 150381514,(Call-In),%YDB-E-ICUSYMNOTFOUND, Symbol u_getVersion not found in the ICU libraries. ICU needs to be built with symbol-renaming disabled or ydb_icu_version/gtm_icu_version environment variable needs to be properly specified,%YDB-I-TEXT, /lib/x86_64-linux-gnu/libicuio.so: undefined symbol: u_getVersion

    r1.34 Debug build

    $ sh ydb_init.sh
    %YDB-F-ASSERT, Assert failed in sr_unix/ydb_init.c line 265 for expression (prev_intrpt_state == intrpt_ok_state)

    Test script and C program

    $ cat ydb_init.sh
    export ydb_chset=M LC_ALL=C gcc ydb_init.c $(pkg-config --libs --cflags yottadb) -o ydbinit
    unset ydb_icu_version gtm_icu_version
    ydb_chset=UTF-8 LC_ALL=en_US.UTF8 ./ydbinit
    $ cat ydb_init.c
    #include "libyottadb.h"
    
    #include <stdio.h>
    
    int     main()
    {
            int     status;
            char    errbuf[1024];
    
            status = ydb_init();
            if (YDB_OK != status)
            {
                    ydb_zstatus(errbuf, sizeof(errbuf));
                    printf("ydb_init() returned status = %d\n", status);
                    printf("ydb_zstatus() returned : %s\n", errbuf);
                    fflush(stdout);
            }
    }
  • It is most likely an issue only in the Debug build. But it is not clear why this worked fine in r1.32 Debug build and started failing only in r1.34. Needs some investigation.

Issue

  • In GT.M V6.3-011, sr_unix/gtm_icu.c had the following change.

    > git show -U1 tags/V6.3-011 sr_unix/gtm_icu.c
    commit 04cc1b83d1c865b8e401978836fcf6aea5d6ab5c (tag: V6.3-011)
    Author: Narayanan Iyer <nars@yottadb.com>
    Date:   Tue Apr 14 15:31:11 2020 -0400
    
        GT.M V6.3-011
    
    diff --git a/sr_unix/gtm_icu.c b/sr_unix/gtm_icu.c
    index b9e53b9e..9ba75372 100755
    --- a/sr_unix/gtm_icu.c
    +++ b/sr_unix/gtm_icu.c
    @@ -439,3 +439,2 @@ void gtm_icu_init(void)
            }
    -       ENABLE_INTERRUPTS(INTRPT_IN_FUNC_WITH_MALLOC, prev_intrpt_state);
            DEBUG_ONLY(symbols_renamed = -1;)
    @@ -509,2 +508,3 @@ void gtm_icu_init(void)
            }
    +       ENABLE_INTERRUPTS(INTRPT_IN_FUNC_WITH_MALLOC, prev_intrpt_state);
            gtm_utf8_mode = TRUE;
  • The ENABLE_INTERRUPTS macro invocation got moved from around line 439 to around line 509.

  • All calls to rts_error_csa() before line 439 had a call to ENABLE_INTERRUPTS before the rts_error_csa() call. But there were 2 calls to rts_error_csa() in between lines 439 and 509 that now needed a call to ENABLE_INTERRUPTS because of the above move. That did not happen as part of the V6.3-011 changes and therefore caused us to go into rts_error_csa() with a non-zero value of prev_interrupt_state which in turn caused the assert failure.

Fix

  • The fix is to invoke ENABLE_INTERRUPTS just before the rts_error_csa() calls between lines 439 and 509.

Merge request reports