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

Deadlock occurs in java.lang.instrumentation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • tbd
    • 5.0u31, 7
    • core-svc

      A CU faces with a serious deadlock in java.lang.instrumentation and stop their system.

      CONFIGURATION:
      OS :
      xxxx 116 % uname -a
      Linux xxxx 2.6.18-164.11.1.el5 #1 SMP Wed Jan 6 13:26:04 EST 2010 x86
      _64 x86_64 x86_64 GNU/Linux

      xxxx 117 % more /etc/redhat-release
      Red Hat Enterprise Linux Server release 5.4 (Tikanga)

      JDK : JDK5u31(32bit)/JDK5u30(32bit)
      java version "1.5.0_31"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_31-b02)
      Java HotSpot(TM) Server VM (build 1.5.0_31-b02, mixed mode)

      java version "1.5.0_30"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_30-b03)
      Java HotSpot(TM) Server VM (build 1.5.0_30-b03, mixed mode)

      REPRODUCE:
      1. unfold attached TP1.zip
      2. Goto TP1 directory
      3. Launch
          "java -javaagent:myagent.jar test1"

      You will see the following message.

      <premain>
      transform:StartInPremain(sun.misc.Launcher$AppClassLoader@18e3e60)
      transform:sun/misc/URLClassPath$FileLoader$1(null)
      transform:test1(sun.misc.Launcher$AppClassLoader@18e3e60)
      transform:LoadBySystemCL(sun.misc.Launcher$AppClassLoader@18e3e60)
      transform:javax/management/MBeanInfo(null)

      4. Open another console, find out the processID, and launch
         "kill -3 <processID>"

      You will see an deadlock in the thread dump.
      (ex. please see the attached deadlock-log-jdk5u31.txt. )

      INVESTIGATION:

      An deadlock occurs between "bootstrap class loader" and a lock(synchronized)
      gotten in javaagent.(This can be confirmed in thread dump)
      When a user use instrument functionality, the user implements transform() method of java.lang.instrument.ClassFileTransformer.
      If the target classes of classloading are classes in rt.jar,
      transform() is called under the status of which "bootstrap class loader" is locked.
      This seems to result in the deadlock.
      If this is a customer with a a support contract this must go through customer support to get the correct prio. thanks!

            Unassigned Unassigned
            tbaba Tadayuki Baba (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: