SIGBUS in setlocale() - HP UX

This is a discussion on SIGBUS in setlocale() - HP UX ; I have an application ported on Windows (2k, 2003), Solaris (9,10) and HPUX (11.i). The application crashes only on HPUX in setlocale() with SIGBUS. The stack looks like: #0 0x425160 in setlocale+0x98 () #1 0x2e52ac in get_charset (_charset=0x79c7c6a8 "\303z4\037\306\016\203c") at ...

+ Reply to Thread
Results 1 to 11 of 11

Thread: SIGBUS in setlocale()

  1. SIGBUS in setlocale()

    I have an application ported on Windows (2k, 2003), Solaris (9,10) and
    HPUX (11.i). The application crashes only on HPUX in setlocale() with
    SIGBUS.
    The stack looks like:

    #0 0x425160 in setlocale+0x98 ()
    #1 0x2e52ac in get_charset (_charset=0x79c7c6a8
    "\303z4\037\306\016\203c") at i18n.c:330
    #2 0x478ff0 in CLIServer:mlch2ch::get_XMLTranscoder (this=0x79c7460c)
    at xmlch2ch.h:39
    .................................................. .................................................. .....

    Of course, the higher frames than #0 are inside our code. The last code
    line is

    crt_locale = strdup(setlocale(LC_CTYPE, NULL));

    The linking command is:
    aCC -Wl,+s -o nidappsrvd -g0 -AA +DAportable -L. -L/usr/lib -L ours library path, including ../../thirdparty/Xerces2.7/hpux/lib> -mt
    -Wl,-a,shared -lpthread -lnsl -lxti -lm -lc -lxerces-c
    -Wl,-a,archive - -lssl -lcrypto

    What is wrong?

    Thank you in advance

    Radu


  2. Re: SIGBUS in setlocale()

    r.darlea@gmail.com wrote:
    > I have an application ported on Windows (2k, 2003), Solaris (9,10) and
    > HPUX (11.i). The application crashes only on HPUX in setlocale() with
    > SIGBUS.
    > The stack looks like:
    >
    > #0 0x425160 in setlocale+0x98 ()
    > #1 0x2e52ac in get_charset (_charset=0x79c7c6a8
    > "\303z4\037\306\016\203c") at i18n.c:330
    > #2 0x478ff0 in CLIServer:mlch2ch::get_XMLTranscoder (this=0x79c7460c)
    > at xmlch2ch.h:39
    > .................................................. .................................................. ....
    >
    > Of course, the higher frames than #0 are inside our code. The last code
    > line is
    >
    > crt_locale = strdup(setlocale(LC_CTYPE, NULL));


    Check if you have the latest patch installed for libc.

    --vishwas.

  3. Re: SIGBUS in setlocale()

    I have PHCO_31903 applied. I will install PHCO_33711.

    Radu


  4. Re: SIGBUS in setlocale()

    I applied PHCO_33711 (and the depedencies). The same crash is occuring,
    with the same stack (except setlocale+0x84() instead of
    setlocale+0x98() ).

    Radu

    p.s. I also rebooted machine after installing the patch.


  5. Re: SIGBUS in setlocale()

    r.darlea@gmail.com writes:

    > The linking command is:
    > aCC -Wl,+s -o nidappsrvd -g0 -AA +DAportable -L. -L/usr/lib -L > ours library path, including ../../thirdparty/Xerces2.7/hpux/lib> -mt
    > -Wl,-a,shared -lpthread -lnsl -lxti -lm -lc -lxerces-c
    > -Wl,-a,archive - -lssl -lcrypto


    This isn't a good link like -- it leaves "-a archive" hanging,
    so you link both libc.sl and libc.a (there is a final -lc added by
    the compiler driver).

    Also, linking system libraries before application ones is not
    very kosher.

    Try:

    aCC -Wl,+s -o nidappsrvd -g0 -AA +DAportable -L. \
    -L \
    -mt -lxerces-c \
    -Wl,-a,archive -l -lssl -lcrypto -Wl,-a,shared \
    -lnsl -lxti # none of -lm, -lpthread, -lc are necessary here

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.

  6. Re: SIGBUS in setlocale()

    Thx for the hint. Unfortunately, the result persists stubbornly. The
    same crash occurs quite quickly. At least now it is rather
    "reproducible" than intermittent.

    Radu


  7. Re: SIGBUS in setlocale()

    r.darlea@gmail.com wrote:
    > crt_locale = strdup(setlocale(LC_CTYPE, NULL));


    I cannot say I know anything about setlocale, but the HP-UX manpage
    says this:

    Setting the Locale of a Program
    To set the program's locale for category, setlocale() accepts
    one of the following values as the locale argument: locale name,
    C, POSIX, or "" (the empty string). The actions prescribed by
    these values are as follows:

    I don't see NULL in there.

    rick jones
    --
    Process shall set you free from the need for rational thought.
    these opinions are mine, all mine; HP might not want them anyway...
    feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...

  8. Re: SIGBUS in setlocale()

    Rick Jones wrote:
    > r.darlea@gmail.com wrote:
    >> crt_locale = strdup(setlocale(LC_CTYPE, NULL));

    >
    > I cannot say I know anything about setlocale, but the HP-UX manpage
    > says this:
    >
    > Setting the Locale of a Program
    > To set the program's locale for category, setlocale() accepts
    > one of the following values as the locale argument: locale name,
    > C, POSIX, or "" (the empty string). The actions prescribed by
    > these values are as follows:
    >
    > I don't see NULL in there.


    Even though it is not explicit, it does mention the NULL usage.

    ! Querying the Locale of a Program
    ! setlocale() queries the current NLS environment pertaining to
    ! category, if the value of locale is NULL. The query operation
    ! does not change the environment.
    !
    !...
    !
    ! To query a user's locale:
    ! char *ch = setlocale(LC_ALL, NULL);

    --vishwas

  9. Re: SIGBUS in setlocale()

    r.darlea@gmail.com wrote:
    > Thx for the hint. Unfortunately, the result persists stubbornly. The
    > same crash occurs quite quickly. At least now it is rather
    > "reproducible" than intermittent.


    Why don't you file a bug report with HP ?

    --vishwas

  10. Re: SIGBUS in setlocale()

    Well, I look over the hp.com and itrc.hp.com, but franckly I wasn't
    able to find HOW to fill a bug... Sorry, maybe it looks stupid. Radu


  11. Re: SIGBUS in setlocale()

    Couldn't find the reason, we decided to avoid the usage. Instead
    querying OS everytime we needed the information, we store the info
    globaly, querying the OS only at startup. No crash since then.

    Radu
    p.s. Thank you guys...


+ Reply to Thread