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

CacheEntry.getJarFile might get dead-lock with CacheJarFile.close()

XMLWordPrintable

      Automate deployment automate unit test run on some platform get hanged with following deadlock:

      Found one Java-level deadlock:
      =============================
      "Thread-1":
         waiting to lock monitor 0x0820f248 (object 0xe34803b0, a
      java.lang.Class),
         which is held by "Finalizer"
      "Finalizer":
         waiting to lock monitor 0x0820ee60 (object 0xe3301348, a
      com.sun.deploy.cache.CacheEntry),
         which is held by "main"
      "main":
         waiting to lock monitor 0x0820f248 (object 0xe34803b0, a
      java.lang.Class),
         which is held by "Finalizer"

      Java stack information for the threads listed above:
      ===================================================
      "Thread-1":
           at com.sun.deploy.cache.MemoryCache.shutdown(Unknown Source)
           - waiting to lock <0xe34803b0> (a java.lang.Class for
      com.sun.deploy.cache.MemoryCache)
           at com.sun.deploy.cache.MemoryCache$1.run(Unknown Source)
      "Finalizer":
           at com.sun.deploy.cache.CacheEntry.getJarFile(Unknown Source)
           - waiting to lock <0xe3301348> (a com.sun.deploy.cache.CacheEntry)
           at com.sun.deploy.cache.MemoryCache.hasReferencesTo(Unknown Source)
           - locked <0xe34803b0> (a java.lang.Class for
      com.sun.deploy.cache.MemoryCache)
           at com.sun.deploy.cache.CachedJarFile.close(Unknown Source)
           at java.util.zip.ZipFile.finalize(ZipFile.java:625)
           at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
           at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:101)
           at java.lang.ref.Finalizer.access$100(Finalizer.java:32)
           at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:178)
      "main":
           at com.sun.deploy.cache.MemoryCache.addResourceReference(Unknown
      Source)
           - waiting to lock <0xe34803b0> (a java.lang.Class for
      com.sun.deploy.cache.MemoryCache)
           at com.sun.deploy.cache.CachedJarFile.<init>(Unknown Source)
           at com.sun.deploy.cache.CachedJarFile.<init>(Unknown Source)
           at com.sun.deploy.cache.CacheEntry$5.run(Unknown Source)
           at java.security.AccessController.doPrivileged(Native Method)
           at com.sun.deploy.cache.CacheEntry.getJarFile(Unknown Source)
           - locked <0xe3301348> (a com.sun.deploy.cache.CacheEntry)
           at com.sun.deploy.cache.CacheEntryTest.downloadJarFile(Unknown Source)
           at
      com.sun.deploy.cache.CacheEntryTest.testSigningData_FromCacheEntry_ToJarFile(Unknown
      Source)
           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:474)
           at junit.framework.TestCase.runTest(TestCase.java:168)
           at junit.framework.TestCase.runBare(TestCase.java:134)
           at sun.tests.junit.DeployTestCase.runBare(Unknown Source)
           at junit.framework.TestResult$1.protect(TestResult.java:110)
           at junit.framework.TestResult.runProtected(TestResult.java:128)
           at junit.framework.TestResult.run(TestResult.java:113)
           at junit.framework.TestCase.run(TestCase.java:124)
           at junit.framework.TestSuite.runTest(TestSuite.java:232)
           at junit.framework.TestSuite.run(TestSuite.java:227)
           at
      org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
           at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:36)
           at
      org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:420)
           at
      org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:911)
           at
      org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:743)

      Found 1 deadlock.

            nam Nam Nguyen (Inactive)
            nam Nam Nguyen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: