JNI:Solaris 9-Signal 11 in realloc()

Discussion in 'Java' started by Mr T, Nov 19, 2003.

  1. Mr T

    Mr T Guest

    JVM 1.3.1

    We produce a system that relies on JNI to access legacy code. The JNI
    code runs OK on Solaris 8, AIX, HP-UX and Linux.

    When we run it on Solaris 9 we get problems.

    I've narrowed the problem down to simply calling free()!

    When it's called from JNI code we get a SIG 11 in realloc() on the
    return.

    The JNI code is very simple:

    -------------------------------------------------

    #define RESDEBUG(s) fflush(stderr);fprintf( stderr, "(%s %ld) - %s\n",
    __FILE__, __LINE__, s )

    JNIEXPORT jstring JNICALL
    Java_com_company_product_package_classname_methodname(

    JNIEnv * pEnv,
    jclass jcls,
    jstring jstrValueName )

    {
    RESDEBUG("JNI Checkpoint ENTER");

    RESDEBUG("JNI Checkpoint: Calling calloc(1,10)");
    char *ptr = (char*)calloc( 1, 10 );
    RESDEBUG("JNI Checkpoint: Called calloc(1,10)");

    // RESDEBUG("JNI Checkpoint: Calling free(ptr)");
    // free( ptr );
    // RESDEBUG("JNI Checkpoint: Called free(ptr)");

    RESDEBUG("JNI Checkpoint EXIT");

    return NULL;
    }

    -------------------------------------------------

    Uncomment the free() and it cores!

    (jniutils.cpp 16) - JNI Checkpoint ENTER
    (jniutils.cpp 18) - JNI Checkpoint: Calling calloc(1,10)
    (jniutils.cpp 20) - JNI Checkpoint: Called calloc(1,10)
    (jniutils.cpp 22) - JNI Checkpoint: Calling free(ptr)
    (jniutils.cpp 24) - JNI Checkpoint: Called free(ptr)
    (jniutils.cpp 26) - JNI Checkpoint EXIT

    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : 11 occurred at PC=0xff2c34cc
    Function name=realloc
    Library=/usr/lib/libc.so.1

    Current Java thread:
    at testThread.run(testThread.java:35)

    Can anyone help?

    Is it the runtime libraries or the way we build to deploy on Solaris 9?

    TIA

    Simon Temple
    UK.
    Mr T, Nov 19, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ralph

    jni on solaris

    ralph, Aug 11, 2003, in forum: Java
    Replies:
    1
    Views:
    559
    Roedy Green
    Aug 11, 2003
  2. Tian

    JNI problem on Solaris 9

    Tian, Sep 3, 2003, in forum: Java
    Replies:
    5
    Views:
    525
    Sean Burke
    Sep 9, 2003
  3. Paul Gammon

    JNI problem on Solaris 9

    Paul Gammon, Jan 7, 2004, in forum: Java
    Replies:
    3
    Views:
    460
    Paul Gammon
    Jan 9, 2004
  4. Hf
    Replies:
    0
    Views:
    507
  5. Steve Gilbert
    Replies:
    3
    Views:
    2,237
    Gordon Beaton
    Apr 14, 2004
Loading...

Share This Page