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

Deadlock between java.lang.ClassLoader and java.util.Properties

    Details

    • Subcomponent:
    • Resolved In Build:
      b116
    • CPU:
      generic
    • OS:
      generic

      Description

      Stress test hangs with stack trace:

      Java stack information for the threads listed above:
      ===================================================
      "Thread-79":
              at java.util.Hashtable.get(Hashtable.java:356)
              - waiting to lock <0x00000000f0007af0> (a java.util.Properties)
              at java.util.Properties.getProperty(Properties.java:949)
              at java.lang.System.getProperty(System.java:703)
              at sun.security.action.GetPropertyAction.run(GetPropertyAction.java:84)
              at sun.security.action.GetPropertyAction.run(GetPropertyAction.java:49)
              at java.security.AccessController.doPrivileged(Native Method)
              at sun.misc.Launcher.getBootstrapClassPath(Launcher.java:384)
              - locked <0x00000000eae2d058> (a java.lang.Class for sun.misc.Launcher)
              at java.lang.ClassLoader.getBootstrapClassPath(ClassLoader.java:1320)
              at java.lang.ClassLoader.getBootstrapResource(ClassLoader.java:1295)
              at java.lang.ClassLoader.getResource(ClassLoader.java:1132)
              at java.lang.ClassLoader.getResource(ClassLoader.java:1130)
              at java.lang.ClassLoader.getResource(ClassLoader.java:1130)
              at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1339)
              at javasoft.sqe.tests.vm.concepts.classes004.classes00401.KlassLoader.findClass(classes00401.java:45)
              - locked <0x00000000f00135a8> (a javasoft.sqe.tests.vm.concepts.classes004.classes00401.KlassLoader)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:422)
              - locked <0x00000000f00135a8> (a javasoft.sqe.tests.vm.concepts.classes004.classes00401.KlassLoader)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:355)
              at javasoft.sqe.tests.vm.concepts.classes004.classes00401.classes00401.run(classes00401.java:18)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:613)
              at nsk.stress.share.StressTest$TestThread.runTest(StressTest.java:722)
              at nsk.stress.share.StressTest$TestThread.run(StressTest.java:755)
      "Thread-68":
              at sun.misc.Launcher.getBootstrapClassPath(Launcher.java:383)
              - waiting to lock <0x00000000eae2d058> (a java.lang.Class for sun.misc.Launcher)
              at java.lang.ClassLoader.getBootstrapClassPath(ClassLoader.java:1320)
              at java.lang.ClassLoader.getBootstrapResources(ClassLoader.java:1306)
              at java.lang.ClassLoader.getResources(ClassLoader.java:1171)
              at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:340)
              at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:432)
              at sun.util.LocaleServiceProviderPool$1.run(LocaleServiceProviderPool.java:118)
              at java.security.AccessController.doPrivileged(Native Method)
              at sun.util.LocaleServiceProviderPool.<init>(LocaleServiceProviderPool.java:116)
              at sun.util.LocaleServiceProviderPool.getPool(LocaleServiceProviderPool.java:98)
              at sun.util.TimeZoneNameUtility.retrieveDisplayNames(TimeZoneNameUtility.java:104)
              at sun.util.TimeZoneNameUtility.retrieveDisplayNames(TimeZoneNameUtility.java:99)
              at java.util.TimeZone.getDisplayNames(TimeZone.java:416)
              at java.util.TimeZone.getDisplayName(TimeZone.java:367)
              at java.util.Date.toString(Date.java:1042)
              at java.util.Properties.store0(Properties.java:824)
              at java.util.Properties.store(Properties.java:813)
              at java.util.Properties.save(Properties.java:710)
              - locked <0x00000000f0007af0> (a java.util.Properties)
              at javasoft.sqe.tests.vm.concepts.unicode001.unicode00103.unicode00103.run(unicode00103.java:78)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:613)
              at nsk.stress.share.StressTest$TestThread.runTest(StressTest.java:722)
              at nsk.stress.share.StressTest$TestThread.run(StressTest.java:755)

      Found 1 deadlock.

        Issue Links

          Activity

          Hide
          mchung Mandy Chung added a comment -
          BT2:EVALUATION

          The deadlock happens as follows:

          One thread (A) tries to get a resource from a system class (from the
          bootclasspath), it synchronizes on the sun.misc.Launcher object and attempts
          to acquire the lock of the system properties object in order to get
          the "sun.boot.class.path" system property. Another thread (B) is holding
          the monitor lock of the system properties object when it calls the
          Properties.save() method to write the property list to a given output stream.
          The Properties.save() method writes the current date and time while holding the lock of the system properties object that causes the threads to deadlock.
          Getting the current date/time (calling Date.toString()) first finds if
          a TimeZone name service provider exists and that attempts to acquire the sun.misc.Launcher object lock which is being held by thread A.

          The Properties.save() method should confine the synchronization to access of the property list and release the lock when it calls methods in other classes.
          Show
          mchung Mandy Chung added a comment - BT2:EVALUATION The deadlock happens as follows: One thread (A) tries to get a resource from a system class (from the bootclasspath), it synchronizes on the sun.misc.Launcher object and attempts to acquire the lock of the system properties object in order to get the "sun.boot.class.path" system property. Another thread (B) is holding the monitor lock of the system properties object when it calls the Properties.save() method to write the property list to a given output stream. The Properties.save() method writes the current date and time while holding the lock of the system properties object that causes the threads to deadlock. Getting the current date/time (calling Date.toString()) first finds if a TimeZone name service provider exists and that attempts to acquire the sun.misc.Launcher object lock which is being held by thread A. The Properties.save() method should confine the synchronization to access of the property list and release the lock when it calls methods in other classes.
          Hide
          mchung Mandy Chung added a comment -
          BT2:EVALUATION

          java.util.zip.ZipFile also gets the system property in its initialization that might be called during the getResource() call and it is another potential place causing a deadlock.
          Show
          mchung Mandy Chung added a comment - BT2:EVALUATION java.util.zip.ZipFile also gets the system property in its initialization that might be called during the getResource() call and it is another potential place causing a deadlock.
          Hide
          mchung Mandy Chung added a comment -
          Show
          mchung Mandy Chung added a comment - BT2:EVALUATION Changeset: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/b444f86c4abe
          Hide
          bchristi Brent Christian added a comment -
          Show
          bchristi Brent Christian added a comment - Updated changeset link: http://hg.openjdk.java.net/jdk7/jdk7/jdk/rev/b444f86c4abe

            People

            • Assignee:
              mchung Mandy Chung
              Reporter:
              nhaustov Nicolay Haustov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: