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

"assert(thread != NULL) failed: just checking" due to Thread::current() and JNI pthread interaction

    Details

    • Subcomponent:
    • Resolved In Build:
      b10
    • CPU:
      x86_64
    • OS:
      generic

      Backports

        Description


        JNI code is using pthread_key_create with a destructor to detach the thread from the JVM when the thread is exiting.

        This solution works well when running on Solaris or a 32 bit JVM on Linux, but when run on 64 bit JVM on Linux the threads hang when detaching.

        For 64 bit Linux the JVM is also using the pthread_key_create, to store the

        Thread::current() value in a thread local storage.

        Since the thread local storage containing the thread pointer is erased (by pthread) before the JNI destructor runs, we run detachCurrentThread on a thread that has NULL as current thread.

        With a product build this breaks locks/monitors, and the threads hang. With a debug build an assert in Thread::current() is hit instead.

        Everything works if detachCurrentThread is called from the main logic instead.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  aeriksso Andreas Eriksson (Inactive)
                  Reporter:
                  asaha Abhijit Saha
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: