segmentation fault with JNI and -AA - HP UX

This is a discussion on segmentation fault with JNI and -AA - HP UX ; Hi, I get a segmentation fault when trying to load a shared library compiled with aCC -AA via JNI. The compilation details are the following: aCC options: compilation: -AA -D_HPUX -D_POSIX_C_SOURCE=199506L +u4 -mt linking: -AA -lstd_v2 -mt aCC -V: aCC: ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: segmentation fault with JNI and -AA

  1. segmentation fault with JNI and -AA


    Hi,

    I get a segmentation fault when trying to load a shared library
    compiled with aCC -AA via JNI. The compilation details are the following:

    aCC options:

    compilation: -AA -D_HPUX -D_POSIX_C_SOURCE=199506L +u4 -mt
    linking: -AA -lstd_v2 -mt

    aCC -V: aCC: HP ANSI C++ B3910B A.03.39

    uname -a: HP-UX xxxx B.11.11 U 9000/785


    The error I get:

    --------- ERROR LOG BEGINS --------------

    Stack_Trace: error while unwinding stack
    ( 0) 0xc636d990 report_and_die__7VMErrorFv + 0x68 [/opt/java1.5/jre/lib/PA_RISC2.0/server/libjvm_v2.sl]
    ( 1) 0xc62568a0 JVM_handle_hpux_signal__Q2_2os4HpuxSFiP9__siginfoP vT1 + 0xaf8 [/opt/java1.5/jre/lib/PA_RISC2.0/server/libjvm_v2.sl]
    ( 2) 0xc62525dc signalHandler__Q2_2os4HpuxSFiP9__siginfoPv + 0x4c [/opt/java1.5/jre/lib/PA_RISC2.0/server/libjvm_v2.sl]
    ( 3) 0xc020d7f8 _sigreturn [/usr/lib/libc.2]
    ( 4) 0xc004d958 pthread_mutex_destroy + 0x18 [/usr/lib/libpthread.1]
    ( 5) 0xc021ece0 __thread_mutex_free + 0x40 [/usr/lib/libc.2]
    ( 6) 0xc92bcb4c __dt__15_HPMutexWrapperFv + 0x48 [/usr/lib/libstd_v2.2]
    ( 7) 0xc8fcc504 _C_getRep__Q2_3std12basic_stringXTcTQ2_3std11char_ traitsXTc_TQ2_3std9allocatorXT + 0x8b4 [/home2/.../wrapper_lib.sl]
    ( 8) 0xc8fcba20 replace__Q2_3std12basic_stringXTcTQ2_3std11char_tr aitsXTc_TQ2_3std9allocatorXTc_ + 0x8b0 [/home2/.../wrapper_lib.sl]
    ( 9) 0xc8fcb0c4 __as__Q2_3std12basic_stringXTcTQ2_3std11char_trait sXTc_TQ2_3std9allocatorXTc__FP + 0xa4 [/home2/.../wrapper_lib.sl]
    (10) 0xc926f200 _C_init__Q2_3std6localeSFv + 0x644 [/usr/lib/libstd_v2.2]
    (11) 0xc926c798 __ct__Q3_3std8ios_base4InitFv_2 + 0x424 [/usr/lib/libstd_v2.2]
    (12) 0xc93c5b3c __sinit_core_arg_lexer_cxx___3stdFv + 0x2c [/home2/..../destination_lib.sl]
    (13) 0xc2476558 __shlInit + 0x88 [/usr/lib/libCsup_v2.2]
    (14) 0xc93b9e88 _shlInit + 0x20 [/home2/..../destination_lib.sl]
    (15) 0xc2475e90 __shlinit + 0xac [/usr/lib/libCsup_v2.2]
    (16) 0xc003051c _shl_load_invoke_initializers + 0xb0 [/usr/lib/dld.sl]
    (17) 0xc003049c _shl_load_invoke_initializers + 0x30 [/usr/lib/dld.sl]
    (18) 0xc003049c _shl_load_invoke_initializers + 0x30 [/usr/lib/dld.sl]
    (19) 0xc003049c _shl_load_invoke_initializers + 0x30 [/usr/lib/dld.sl]
    (20) 0xc003049c _shl_load_invoke_initializers + 0x30 [/usr/lib/dld.sl]
    (21) 0xc003049c _shl_load_invoke_initializers + 0x30 [/usr/lib/dld.sl]
    (22) 0xc003049c _shl_load_invoke_initializers + 0x30 [/usr/lib/dld.sl]
    (23) 0xc003049c _shl_load_invoke_initializers + 0x30 [/usr/lib/dld.sl]
    (24) 0xc003049c _shl_load_invoke_initializers + 0x30 [/usr/lib/dld.sl]
    (25) 0xc003049c _shl_load_invoke_initializers + 0x30 [/usr/lib/dld.sl]
    (26) 0xc0030e5c _shl_load + 0x574 [/usr/lib/dld.sl]
    (27) 0xc0005e44 __shl_load + 0xf0 [/usr/lib/libdld.2]
    (28) 0xc21fd7bc shlib_open + 0x24 [/opt/java1.5/jre/lib/PA_RISC2.0/native_threads/libhpi.sl]
    (29) 0xc21fd6e8 sysLoadLibrary + 0x28 [/opt/java1.5/jre/lib/PA_RISC2.0/native_threads/libhpi.sl]
    (30) 0xc6084fc4 dll_load__3hpiSFPCcPci + 0xc4 [/opt/java1.5/jre/lib/PA_RISC2.0/server/libjvm_v2.sl]
    (31) 0xc6084e28 JVM_LoadLibrary + 0x68 [/opt/java1.5/jre/lib/PA_RISC2.0/server/libjvm_v2.sl]
    (32) 0xc2b250dc Java_java_lang_ClassLoader_00024NativeLibrary_load + 0x64 [/opt/java1.5/jre/lib/PA_RISC2.0/libjava.sl]
    #
    # An unexpected error has been detected by HotSpot Virtual Machine:
    #
    # SIGSEGV (11) at pc=c004d958, pid=5121, tid=1
    #
    # Java VM: Java HotSpot(TM) Server VM (1.5.0.02 jinteg:10.14.05-17:37 PA2.0 (aCC_AA) mixed mode)
    # Problematic frame:
    # C [libpthread.1+0xd958] pthread_mutex_destroy+0x30
    #
    # An error report file with more information is saved as hs_err_pid5121.log
    #
    # Please report this error to HP customer support.
    #
    ../testjni: line 1: 5121 ABORT instruction $JAVA_HOME/bin/java -V2 -classpath ../build testjni

    --------- ERROR LOG ENDS --------------

    As you can see, the shared libraries are using std::string, which seems to cause problems.
    The wrapper_lib.sl is an intermediate wrapper library used to access destination_lib.sl from Java.

    Anybody encountered such error?

    Thanks,
    AD


  2. Re: segmentation fault with JNI and -AA

    (Oops, sorry about a previous empty useful content post.)

    AD wrote:
    : I get a segmentation fault when trying to load a shared library
    : compiled with aCC -AA via JNI. The compilation details are the following:
    : compilation: -AA -D_HPUX -D_POSIX_C_SOURCE=199506L +u4 -mt
    : linking: -AA -lstd_v2 -mt
    : aCC: HP ANSI C++ B3910B A.03.39

    Have you consistently compiled ALL of your aC++ shlibs with -mt??
    Especially wrapper_lib.sl and destination_lib.sl?

    : ( 3) 0xc020d7f8 _sigreturn [/usr/lib/libc.2]
    : ( 4) 0xc004d958 pthread_mutex_destroy + 0x18 [/usr/lib/libpthread.1]
    : ( 5) 0xc021ece0 __thread_mutex_free + 0x40 [/usr/lib/libc.2]
    : ( 6) 0xc92bcb4c __dt__15_HPMutexWrapperFv + 0x48 [/usr/lib/libstd_v2.2]
    : ( 7) 0xc8fcc504 _C_getRep__Q2_3std12basic_stringXTcTQ2_3std11char_ traitsXTc_TQ2_3std9allocatorXT + 0x8b4 [.../wrapper_lib.sl]
    : ( 8) 0xc8fcba20 replace__Q2_3std12basic_stringXTcTQ2_3std11char_tr aitsXTc_TQ2_3std9allocatorXTc_ + 0x8b0 [.../wrapper_lib.sl]
    : ( 9) 0xc8fcb0c4 __as__Q2_3std12basic_stringXTcTQ2_3std11char_trait sXTc_TQ2_3std9allocatorXTc__FP + 0xa4 [.../wrapper_lib.sl]
    : (10) 0xc926f200 _C_init__Q2_3std6localeSFv + 0x644 [/usr/lib/libstd_v2.2]
    : (11) 0xc926c798 __ct__Q3_3std8ios_base4InitFv_2 + 0x424 [/usr/lib/libstd_v2.2]
    : (12) 0xc93c5b3c __sinit_core_arg_lexer_cxx___3stdFv + 0x2c [.../destination_lib.sl]

    : As you can see, the shared libraries are using std::string, which seems to
    : cause problems.
    : The wrapper_lib.sl is an intermediate wrapper library used to access
    : destination_lib.sl from Java.
    : Anybody encountered such error?
    : AD

    Yes, if you don't use -mt consistently.


+ Reply to Thread