Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6201185

FATAL ERROR in native method: JNI call made with exception pending at java.lang.Thread.sleep(NativeM

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1
    • Resolution: Fixed
    • Affects Version/s: 1.4.2_07, 5.0u2, 6
    • Fix Version/s: 1.4.2_07
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b04
    • CPU:
      generic
    • OS:
      generic, linux, solaris

      Backports

        Description

        One more issue with the strict jni checks added for checking pending
        exceptions before making jni calls. (Note: These failures occur with and
        without 5101288 fix)

        We are seeing JCK failures of two kinds; one in Thread.sleep() and
        another in Object,wait().

        (You can access jck testcase
        javasoft.sqe.test.api.java.lang.Thread.isAliveTests and
        javasoft.sqe.test.api.java.io.PipedOutputStream.WriteTests from
        /net/jlab113.india/export/jpse/pb131437/jck/ )

        FATAL ERROR in native method: JNI call made with exception pending
                 at java.lang.Thread.sleep(Native Method)

        FATAL ERROR in native method: JNI call made with exception pending
                 at java.lang.Object.wait(Native Method)

        The first failure (in Thread.sleep):
        =================================
        In JVM_Sleep(), vm checks if there is a pending exception, when it does
        not find any, it calls
        THROW_MSG(vmSysmbols::java_lang_interruptedException(), "sleep
        interrupted");

        And while handling this exception, VM installs another exception, shown
        in following trace:

        -->>Thread::set_pending_exception(oopDesc * 0x102ab318, const char *
        0x0865595c, int 1395) line 426
        JavaThread::check_and_handle_async_exceptions(int 1) line 1397
        JavaThread::handle_special_runtime_exit_condition(int 1) line 1458
        ThreadToNativeFromVM::ThreadToNativeFromVM(JavaThread * 0x00790248) line
        199
        Verifier::verify_byte_codes(instanceKlassHandle {...}, Thread *
        0x00790248) line 168
        instanceKlass::verify_code(instanceKlassHandle {...}, Thread *
        0x00790248) line 97 + 13 bytes
        instanceKlass::link_class_impl(instanceKlassHandle {...}, Thread *
        0x00790248) line 216 + 13 bytes
        instanceKlass::link_class(Thread * 0x00790248) line 166 + 13 bytes
        instanceKlass::initialize_impl(instanceKlassHandle {...}, Thread *
        0x00790248) line 243 + 19 bytes
        instanceKlass::initialize(Thread * 0x00790248) line 85 + 13 bytes
        Exceptions::new_exception(Thread * 0x00790248, symbolHandle {...},
        symbolHandle {...}, JavaCallArguments * 0x1858faf0, Handle {...}, Hand
        le {...}) line 170
        Exceptions::new_exception(Thread * 0x00790248, symbolHandle {...}, const
        char * 0x085cdd9c, Handle {...}, Handle {...}) line 225 + 36 byt
        es
        Exceptions::_throw_msg(Thread * 0x00790248, const char * 0x085cddb0, int
        2061, symbolHandle {...}, const char * 0x085cdd9c, Handle {...},
          Handle {...}) line 97 + 29 bytes
        Exceptions::_throw_msg(Thread * 0x00790248, const char * 0x085cddb0, int
        2061, symbolOopDesc * 0x14271a40, const char * 0x085cdd9c) line
        107 + 33 bytes
        JVM_Sleep(JNIEnv_ * 0x007902f4, _jclass * 0x1858fc34, __int64 60000)
        line 2061 + 30 bytes
        00fb9cc8()
        00fb2ed3()
        00fb31d9()
        00fb0275()
        JavaCalls::call_helper(JavaValue * 0x1858fefc, methodHandle *
        0x1858fde8, JavaCallArguments * 0x1858fe50, Thread * 0x00790248) line
        373 + 54 bytes
        os::os_exception_wrapper(void (JavaValue *, methodHandle *,
        JavaCallArguments *, Thread *)* 0x08011919 JavaCalls::call_helper(class
        JavaValue *,class methodHandle *,class JavaCallArguments *,class Thread
        *), JavaValue * 0x1858fefc, methodHandle * 0x1858fde8, JavaCallArgumen
        ts * 0x1858fe50, Thread * 0x00790248) line 53 + 19 bytes
        JavaCalls::call(JavaValue * 0x1858fefc, methodHandle {...},
        JavaCallArguments * 0x1858fe50, Thread * 0x00790248) line 300 + 26 bytes
        JavaCalls::call_virtual(JavaValue * 0x1858fefc, KlassHandle {...},
        symbolHandle {...}, symbolHandle {...}, JavaCallArguments * 0x1858fe50
        , Thread * 0x00790248) line 187 + 21 bytes
        JavaCalls::call_virtual(JavaValue * 0x1858fefc, Handle {...},
        KlassHandle {...}, symbolHandle {...}, symbolHandle {...}, Thread *
        0x00790248) line 193 + 29 bytes
        thread_entry(JavaThread * 0x00790248, Thread * 0x00790248) line 1848 +
        68 bytes
        JavaThread::thread_main_inner() line 1136 + 18 bytes
        JavaThread::run() line 1123
        _start(Thread * 0x00790248) line 290
        _threadstartex(void * 0x00791b40) line 212 + 13 bytes
        KERNEL32! 77f04ede()


        ===>>>Now, VM enters functionEnter() in jniCheck.cpp with a pending
        exception:

        -->>functionEnter(JavaThread * 0x00790248) line 156
        checked_jni_NewGlobalRef(JNIEnv_ * 0x007902f4, _jobject * 0x00782e4c)
        line 554 + 9 bytes
        class_to_ID(context_type * 0x1858f524, _jobject * 0x00782e4c, unsigned
        char 1) line 558 + 16 bytes
        make_loadable_class_info(context_type * 0x1858f524, _jobject *
        0x00782e4c) line 647 + 15 bytes
        VerifyClass(const JNINativeInterface_ * * 0x007902f4, _jobject *
        0x00782e4c, char * 0x1858f764, long 256) line 725 + 13 bytes
        VerifyClassCodes(const JNINativeInterface_ * * 0x007902f4, _jobject *
        0x00782e4c, char * 0x1858f764, long 256) line 47 + 22 bytes
        Verifier::verify_byte_codes(instanceKlassHandle {...}, Thread *
        0x00790248) line 168 + 29 bytes
        instanceKlass::verify_code(instanceKlassHandle {...}, Thread *
        0x00790248) line 97 + 13 bytes
        instanceKlass::link_class_impl(instanceKlassHandle {...}, Thread *
        0x00790248) line 216 + 13 bytes
        instanceKlass::link_class(Thread * 0x00790248) line 166 + 13 bytes
        instanceKlass::initialize_impl(instanceKlassHandle {...}, Thread *
        0x00790248) line 243 + 19 bytes
        instanceKlass::initialize(Thread * 0x00790248) line 85 + 13 bytes
        Exceptions::new_exception(Thread * 0x00790248, symbolHandle {...},
        symbolHandle {...}, JavaCallArguments * 0x1858faf0, Handle {...}, Hand
        le {...}) line 170
        Exceptions::new_exception(Thread * 0x00790248, symbolHandle {...}, const
        char * 0x085cdd9c, Handle {...}, Handle {...}) line 225 + 36 bytes
        Exceptions::_throw_msg(Thread * 0x00790248, const char * 0x085cddb0, int
        2061, symbolHandle {...}, const char * 0x085cdd9c, Handle {...},
          Handle {...}) line 97 + 29 bytes
        Exceptions::_throw_msg(Thread * 0x00790248, const char * 0x085cddb0, int
        2061, symbolOopDesc * 0x14271a40, const char * 0x085cdd9c) line
        107 + 33 bytes
        JVM_Sleep(JNIEnv_ * 0x007902f4, _jclass * 0x1858fc34, __int64 60000)
        line 2061 + 30 bytes


        =====>>>>>> Should we not skip the installation of async exception while
        transtioning from VM to Native also as we did in 5101288 for
        native_trans (Native to VM) ?? Or something else is wrong???

        You can run the testcase as below:
        java -Xfuture -Xcheck:jni
        javasoft.sqe.tests.api.java.lang.Thread.isAliveTests

        Note: the problem reproduces only with -Xfuture


        Second failure (in Object.wait())
        ================================

        This is also due to pending exception being installed by VM when thread
        is going to Native for VM

        -->>Thread::set_pending_exception(oopDesc * 0x102be5c0, const char *
        0x0865595c, int 1395) line 426
        JavaThread::check_and_handle_async_exceptions(int 1) line 1397
        JavaThread::handle_special_runtime_exit_condition(int 1) line 1458
        ThreadToNativeFromVM::ThreadToNativeFromVM(JavaThread * 0x00791a58) line 199
        Verifier::verify_byte_codes(instanceKlassHandle {...}, Thread *
        0x00791a58) line 168
        instanceKlass::verify_code(instanceKlassHandle {...}, Thread *
        0x00791a58) line 97 + 13 bytes
        instanceKlass::link_class_impl(instanceKlassHandle {...}, Thread *
        0x00791a58) line 216 + 13 bytes
        instanceKlass::link_class(Thread * 0x00791a58) line 166 + 13 bytes
        instanceKlass::initialize_impl(instanceKlassHandle {...}, Thread *
        0x00791a58) line 243 + 19 bytes
        instanceKlass::initialize(Thread * 0x00791a58) line 85 + 13 bytes
        Exceptions::new_exception(Thread * 0x00791a58, symbolHandle {...},
        symbolHandle {...}, JavaCallArguments * 0x187cfa40, Handle {...}, Hand
        le {...}) line 170
        Exceptions::new_exception(Thread * 0x00791a58, symbolHandle {...}, const
        char * 0x00000000, Handle {...}, Handle {...}) line 225 + 36 bytes
        Exceptions::_throw_msg(Thread * 0x00791a58, const char * 0x0860fd4c, int
        298, symbolHandle {...}, const char * 0x00000000, Handle {...},
        Handle {...}) line 97 + 29 bytes
        Exceptions::_throw_msg(Thread * 0x00791a58, const char * 0x0860fd4c, int
        298, symbolOopDesc * 0x14271a40, const char * 0x00000000) line 1
        07 + 33 bytes
        ObjectMonitor::wait(__int64 1000, int 1, Thread * 0x00791a58) line 298 +
        27 bytes
        ObjectSynchronizer::wait(Handle {...}, __int64 1000, Thread *
        0x00791a58) line 380
        JVM_MonitorWait(JNIEnv_ * 0x00791b04, _jobject * 0x187cfc40, __int64
        1000) line 387 + 21 bytes


        ===>>>And in functionEnter, VM find a pending exception while calling
        checked_jni_NewGlobalRef:

        ->>functionEnter(JavaThread * 0x00791a58) line 156
        checked_jni_NewGlobalRef(JNIEnv_ * 0x00791b04, _jobject * 0x00782e4c)
        line 554 + 9 bytes
        class_to_ID(context_type * 0x187cf474, _jobject * 0x00782e4c, unsigned
        char 1) line 558 + 16 bytes
        make_loadable_class_info(context_type * 0x187cf474, _jobject *
        0x00782e4c) line 647 + 15 bytes
        VerifyClass(const JNINativeInterface_ * * 0x00791b04, _jobject *
        0x00782e4c, char * 0x187cf6b4, long 256) line 725 + 13 bytes
        VerifyClassCodes(const JNINativeInterface_ * * 0x00791b04, _jobject *
        0x00782e4c, char * 0x187cf6b4, long 256) line 47 + 22 bytes
        Verifier::verify_byte_codes(instanceKlassHandle {...}, Thread *
        0x00791a58) line 168 + 29 bytes
        instanceKlass::verify_code(instanceKlassHandle {...}, Thread *
        0x00791a58) line 97 + 13 bytes
        instanceKlass::link_class_impl(instanceKlassHandle {...}, Thread *
        0x00791a58) line 216 + 13 bytes
        instanceKlass::link_class(Thread * 0x00791a58) line 166 + 13 bytes
        instanceKlass::initialize_impl(instanceKlassHandle {...}, Thread *
        0x00791a58) line 243 + 19 bytes
        instanceKlass::initialize(Thread * 0x00791a58) line 85 + 13 bytes
        Exceptions::new_exception(Thread * 0x00791a58, symbolHandle {...},
        symbolHandle {...}, JavaCallArguments * 0x187cfa40, Handle {...}, Hand
        le {...}) line 170
        Exceptions::new_exception(Thread * 0x00791a58, symbolHandle {...}, const
        char * 0x00000000, Handle {...}, Handle {...}) line 225 + 36 byt
        es
        Exceptions::_throw_msg(Thread * 0x00791a58, const char * 0x0860fd4c, int
        298, symbolHandle {...}, const char * 0x00000000, Handle {...},
        Handle {...}) line 97 + 29 bytes
        Exceptions::_throw_msg(Thread * 0x00791a58, const char * 0x0860fd4c, int
        298, symbolOopDesc * 0x14271a40, const char * 0x00000000) line 1
        07 + 33 bytes
        ObjectMonitor::wait(__int64 1000, int 1, Thread * 0x00791a58) line 298 +
        27 bytes
        ObjectSynchronizer::wait(Handle {...}, __int64 1000, Thread *
        0x00791a58) line 380
        JVM_MonitorWait(JNIEnv_ * 0x00791b04, _jobject * 0x187cfc40, __int64
        1000) line 387 + 21 bytes



          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  poonam Poonam Bajaj Parhar
                  Reporter:
                  chrisphi Chris Phillips
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: