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

One time crash on exit in JNIEnv_::CallObjectMethod

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: javafx
    • Labels:
      None
    • Subcomponent:
      web
    • Understanding:
      Fix Understood

      Description

      I only saw this one time while running:

      java hello.HelloWebView https://www.bankofamerica.com/

      I made the screen larger, clcked around a bit, then closed the window. The crash happened at that point. The hs_err file is attached.

        Issue Links

          Activity

          Hide
          kcr Kevin Rushforth added a comment -
          This is quite possibly unrelated, but I was running with a build that includes the fix for JDK-8196677
          Show
          kcr Kevin Rushforth added a comment - This is quite possibly unrelated, but I was running with a build that includes the fix for JDK-8196677
          Hide
          arajkumar Arunprasad Rajkumar added a comment -
          Though I couldn't see crash during my testing, I got the below exception.

          Exception in thread "Thread-19" java.lang.IllegalStateException: Service must only be used from the FX Application Thread
          at javafx.graphics/javafx.concurrent.Service.checkThread(Service.java:906)
          at javafx.graphics/javafx.concurrent.Service.isRunning(Service.java:224)
          at javafx.web/com.sun.javafx.webkit.prism.WCImageDecoderImpl.startLoader(WCImageDecoderImpl.java:144)
          at javafx.web/com.sun.javafx.webkit.prism.WCImageDecoderImpl.getImageFrame(WCImageDecoderImpl.java:329)
          at javafx.web/com.sun.javafx.webkit.prism.WCImageDecoderImpl.getFrame(WCImageDecoderImpl.java:272)

          Looks like something wrong when our image decoders are called from WebKit's threaded image decoding.
          Show
          arajkumar Arunprasad Rajkumar added a comment - Though I couldn't see crash during my testing, I got the below exception. Exception in thread "Thread-19" java.lang.IllegalStateException: Service must only be used from the FX Application Thread at javafx.graphics/javafx.concurrent.Service.checkThread(Service.java:906) at javafx.graphics/javafx.concurrent.Service.isRunning(Service.java:224) at javafx.web/com.sun.javafx.webkit.prism.WCImageDecoderImpl.startLoader(WCImageDecoderImpl.java:144) at javafx.web/com.sun.javafx.webkit.prism.WCImageDecoderImpl.getImageFrame(WCImageDecoderImpl.java:329) at javafx.web/com.sun.javafx.webkit.prism.WCImageDecoderImpl.getFrame(WCImageDecoderImpl.java:272) Looks like something wrong when our image decoders are called from WebKit's threaded image decoding.
          Hide
          kcr Kevin Rushforth added a comment -
          Interesting observation. Not sure whether it is related to the crash or not...
          Show
          kcr Kevin Rushforth added a comment - Interesting observation. Not sure whether it is related to the crash or not...
          Hide
          arajkumar Arunprasad Rajkumar added a comment - - edited
          >> # SIGSEGV (0xb) at pc=0x000000013f212b99, pid=68788, tid=775

          Access at address `0xb` seems to be a null pointer access from native side, probably 'env' may have become null while closing the window?

          I see a null check for 'env' pointer in RenderQueue,

          void RenderingQueue::disposeGraphics() {
              JNIEnv* env = WebCore_GetJavaEnv();
              // The method is called from the dtor which potentially can be called after VM detach.
              // So the check for nullptr.
              if (!env)
                 return;

          But the exception which I posted earlier seems to be a different issue.
          Show
          arajkumar Arunprasad Rajkumar added a comment - - edited >> # SIGSEGV (0xb) at pc=0x000000013f212b99, pid=68788, tid=775 Access at address `0xb` seems to be a null pointer access from native side, probably 'env' may have become null while closing the window? I see a null check for 'env' pointer in RenderQueue, void RenderingQueue::disposeGraphics() {     JNIEnv* env = WebCore_GetJavaEnv();     // The method is called from the dtor which potentially can be called after VM detach.     // So the check for nullptr.     if (!env)        return; But the exception which I posted earlier seems to be a different issue.
          Hide
          arajkumar Arunprasad Rajkumar added a comment - - edited
          By enforcing 'nullptr' to 'env' pointer, I got the below crash log which matches exactly with [~kcr]'s crash log.

          # SIGSEGV (0xb) at pc=0x000000013b426be9, pid=62085, tid=775
          #
          # JRE version: Java(TM) SE Runtime Environment (10.0.1+4) (build 10.0.1+4)
          # Java VM: Java HotSpot(TM) 64-Bit Server VM (10.0.1+4, mixed mode, tiered, compressed oops, g1 gc, bsd-amd64)
          # Problematic frame:
          # C [libjfxwebkit.dylib+0xabbbe9] JNIEnv_::CallObjectMethod(_jobject*, _jmethodID*, ...)+0x79

          Also from the attached crash log, I could see the 'THREAD' section shows the current thread as 'native thread' instead of it's actual name. It means that the main thread(aka "JavaFX Application Thread" ) is detached from JVM.

          --------------- T H R E A D ---------------

          Current thread is native thread
          ....

          I think it is better to do a null check before accessing 'env' in all the places. [~kcr], What is your opinion?
          Show
          arajkumar Arunprasad Rajkumar added a comment - - edited By enforcing 'nullptr' to 'env' pointer, I got the below crash log which matches exactly with [~kcr]'s crash log. # SIGSEGV (0xb) at pc=0x000000013b426be9, pid=62085, tid=775 # # JRE version: Java(TM) SE Runtime Environment (10.0.1+4) (build 10.0.1+4) # Java VM: Java HotSpot(TM) 64-Bit Server VM (10.0.1+4, mixed mode, tiered, compressed oops, g1 gc, bsd-amd64) # Problematic frame: # C [libjfxwebkit.dylib+0xabbbe9] JNIEnv_::CallObjectMethod(_jobject*, _jmethodID*, ...)+0x79 Also from the attached crash log, I could see the 'THREAD' section shows the current thread as 'native thread' instead of it's actual name. It means that the main thread(aka "JavaFX Application Thread" ) is detached from JVM. --------------- T H R E A D --------------- Current thread is native thread .... I think it is better to do a null check before accessing 'env' in all the places. [~kcr], What is your opinion?
          Hide
          kcr Kevin Rushforth added a comment -
          I think adding null checks as you suggest seems good, at least for any method that can be called from a destructor.
          Show
          kcr Kevin Rushforth added a comment - I think adding null checks as you suggest seems good, at least for any method that can be called from a destructor.

            People

            • Assignee:
              arajkumar Arunprasad Rajkumar
              Reporter:
              kcr Kevin Rushforth
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: