glassfish
  1. glassfish
  2. GLASSFISH-7274

deadlock in logging code preventing modules to start

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: V3
    • Fix Version/s: 4.0_b46
    • Component/s: logging
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: Sun

    • Issuezilla Id:
      7,274

      Description

      Observed deadlock in logging code as shown below:

      Found one Java-level deadlock:
      =============================
      "pool-2-thread-1":
      waiting to lock monitor 0x0812210c (object 0xa0508950, a
      java.util.logging.LogManager),
      which is held by
      "

      {felix.fileinstall.dir=/space/ss141213/WS/gf/v3.trunk.new/publish/glassfish/modules2/, felix.fileinstall.debug=1}"
      "{felix.fileinstall.dir=/space/ss141213/WS/gf/v3.trunk.new/publish/glassfish/modules2/,felix.fileinstall.debug=1}

      ":
      waiting to lock monitor 0x08122940 (object 0xa8eb3620, a java.lang.Class),
      which is held by "pool-2-thread-1"

      Java stack information for the threads listed above:
      ===================================================
      "pool-2-thread-1":
      at java.util.logging.LogManager.addLogger(LogManager.java:326)

      • waiting to lock <0xa0508950> (a java.util.logging.LogManager)
        at java.util.logging.Logger.getLogger(Logger.java:321)
      • locked <0xa8eb3620> (a java.lang.Class for java.util.logging.Logger)
        at com.sun.pkg.client.Image.<clinit>(Image.java:762)
        at
        com.sun.enterprise.registration.glassfish.RegistrationUtil.getUpdateCenterImage(RegistrationUtil.java:175)
        at
        com.sun.enterprise.registration.glassfish.RegistrationUtil.setUpdateCenterUUID(RegistrationUtil.java:182)
        at
        com.sun.enterprise.registration.glassfish.RegistrationUtil.synchUUID(RegistrationUtil.java:169)
        at
        com.sun.enterprise.registration.glassfish.PingService.postConstruct(PingService.java:85)
        at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:160)
        at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:90)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:87)
        at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
        at
        com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
      • locked <0xa0d95e70> (a com.sun.hk2.component.SingletonInhabitant)
        at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
        at
        com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
        at
        com.sun.enterprise.v3.server.AppServerStartup$2.run(AppServerStartup.java:191)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at
        java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        at
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)
        " {felix.fileinstall.dir=/space/ss141213/WS/gf/v3.trunk.new/publish/glassfish/modules2/, felix.fileinstall.debug=1}

        ":
        at java.util.logging.Logger.getLogger(Logger.java:274)

      • waiting to lock <0xa8eb3620> (a java.lang.Class for
        java.util.logging.Logger)
        at java.util.logging.LogManager.addLogger(LogManager.java:399)
      • locked <0xa0508950> (a java.util.logging.LogManager)
        at com.sun.logging.LogDomains.getLogger(LogDomains.java:299)
        at com.sun.enterprise.web.WebContainer.<clinit>(WebContainer.java:200)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at
        sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at
        sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at com.sun.hk2.component.ConstructorWomb.create(ConstructorWomb.java:72)
        at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:76)
        at
        com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
      • locked <0xa0eacd90> (a com.sun.hk2.component.SingletonInhabitant)
        at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
        at
        com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
        at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:567)
        at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:548)
        at org.jvnet.hk2.component.Habitat.getComponent(Habitat.java:317)
        at org.glassfish.internal.api.Globals.get(Globals.java:53)
        at
        org.glassfish.web.osgihttp.Activator.getStandardContext(Activator.java:93)
        at org.glassfish.web.osgihttp.Activator.start(Activator.java:85)
        at
        org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:591)
        at org.apache.felix.framework.Felix._startBundle(Felix.java:1607)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1541)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:371)
        at
        org.apache.felix.fileinstall.DirectoryWatcher.start(DirectoryWatcher.java:750)
        at
        org.apache.felix.fileinstall.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:770)
        at
        org.apache.felix.fileinstall.DirectoryWatcher.doInstalled(DirectoryWatcher.java:353)
        at
        org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.java:118)

      Found 1 deadlock.

      1. dump.txt
        25 kB
        marina vatkina
      2. logging-diff.txt
        2 kB
        Jagadish

        Activity

        Hide
        carlavmott added a comment -
            • Issue 8191 has been marked as a duplicate of this issue. ***
        Show
        carlavmott added a comment - Issue 8191 has been marked as a duplicate of this issue. ***
        Hide
        Sanjeeb Sahoo added a comment -

        This is still an issue.

        Show
        Sanjeeb Sahoo added a comment - This is still an issue.
        Hide
        Jagadish added a comment -

        Attachment contains a fix that makes sure that the locks for Logger and LogManager are acquired in the same fashion like any other callers. ie., lock should be obtained for Logger first and then LogManager.

        Show
        Jagadish added a comment - Attachment contains a fix that makes sure that the locks for Logger and LogManager are acquired in the same fashion like any other callers. ie., lock should be obtained for Logger first and then LogManager.
        Hide
        Sanjeeb Sahoo added a comment -

        Sandeep,

        Could you please take a look at this attached patch and apply the same after doing necessary testing? It looks alright to us. The patch ensures that in this code path, LogManager is not logged before Logger.class.

        Sahoo

        Show
        Sanjeeb Sahoo added a comment - Sandeep, Could you please take a look at this attached patch and apply the same after doing necessary testing? It looks alright to us. The patch ensures that in this code path, LogManager is not logged before Logger.class. Sahoo
        Hide
        Sanjeeb Sahoo added a comment -

        Fix checked in svn rev #55088. This should be backported to 3.1.x by logging team & sustaining team.

        Show
        Sanjeeb Sahoo added a comment - Fix checked in svn rev #55088. This should be backported to 3.1.x by logging team & sustaining team.

          People

          • Assignee:
            Sanjeeb Sahoo
            Reporter:
            Sanjeeb Sahoo
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: