Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-883

Deadlock with kcontainer.updateToVersion() under load

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.3.0.CR2
    • None
    • core engine
    • None

      Calling kcontainer.updateToVersion() under load causes a deadlock. See attached reproducer and thread dump.

      Found one Java-level deadlock:
      =============================
      "pool-8-thread-11":
        waiting for ownable synchronizer 0x00000007bd812568, (a java.util.concurrent.locks.ReentrantLock$NonfairSync),
        which is held by "pool-8-thread-4"
      "pool-8-thread-4":
        waiting for ownable synchronizer 0x000000070a08e9f8, (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync),
        which is held by "pool-8-thread-1"
      "pool-8-thread-1":
        waiting for ownable synchronizer 0x00000007bd812568, (a java.util.concurrent.locks.ReentrantLock$NonfairSync),
        which is held by "pool-8-thread-4"
      
      Java stack information for the threads listed above:
      ===================================================
      "pool-8-thread-11":
      	at sun.misc.Unsafe.park(Native Method)
      	- parking to wait for  <0x00000007bd812568> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
      	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
      	at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:214)
      	at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:290)
      	at org.drools.core.common.NamedEntryPoint.insert(NamedEntryPoint.java:190)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:1477)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:1432)
      	at com.sample.CallKjarTest$2.run(CallKjarTest.java:66)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      "pool-8-thread-4":
      	at sun.misc.Unsafe.park(Native Method)
      	- parking to wait for  <0x000000070a08e9f8> (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync)
      	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:964)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282)
      	at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731)
      	at org.drools.core.impl.KnowledgeBaseImpl.readLock(KnowledgeBaseImpl.java:700)
      	at org.drools.core.common.NamedEntryPoint.insert(NamedEntryPoint.java:191)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:1477)
      	at org.drools.core.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:1432)
      	at com.sample.CallKjarTest$2.run(CallKjarTest.java:66)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      "pool-8-thread-1":
      	at sun.misc.Unsafe.park(Native Method)
      	- parking to wait for  <0x00000007bd812568> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
      	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
      	at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:214)
      	at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:290)
      	at org.drools.core.common.NamedEntryPoint.delete(NamedEntryPoint.java:481)
      	at org.drools.core.common.NamedEntryPoint.delete(NamedEntryPoint.java:468)
              at org.drools.core.impl.StatefulKnowledgeSessionImpl$WorkingMemoryReteExpireAction.execute(StatefulKnowledgeSessionImpl.java:1779)
              at org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:96)
              at org.drools.core.phreak.SynchronizedPropagationList.flush(SynchronizedPropagationList.java:69)
              at org.drools.core.impl.StatefulKnowledgeSessionImpl.flushPropagations(StatefulKnowledgeSessionImpl.java:2007)
              at org.drools.core.phreak.AddRemoveRule.removeRule(AddRemoveRule.java:153)
              at org.drools.core.reteoo.ReteooBuilder.removeTerminalNode(ReteooBuilder.java:161)
              at org.drools.core.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:155)
              - locked <0x00000007bd7cbfd8> (a org.drools.core.reteoo.ReteooBuilder)
              at org.drools.core.impl.KnowledgeBaseImpl.removeRule(KnowledgeBaseImpl.java:1608)
              at org.drools.core.impl.KnowledgeBaseImpl.removeRule(KnowledgeBaseImpl.java:1599)
              at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.preProcessRules(KnowledgeBuilderImpl.java:1141)
              at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.compileRules(KnowledgeBuilderImpl.java:1084)
              at org.drools.compiler.builder.impl.KnowledgeBuilderImpl.compileAllRules(KnowledgeBuilderImpl.java:967)
              at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildRules(CompositeKnowledgeBuilderImpl.java:256)
              at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildPackages(CompositeKnowledgeBuilderImpl.java:120)
              at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:104)
              at org.drools.compiler.kie.builder.impl.KieContainerImpl.rebuildAll(KieContainerImpl.java:369)
              at org.drools.compiler.kie.builder.impl.KieContainerImpl.update(KieContainerImpl.java:207)
              at org.drools.compiler.kie.builder.impl.KieContainerImpl.updateToVersion(KieContainerImpl.java:128)
              at com.sample.CallKjarTest$1.run(CallKjarTest.java:45)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:745)
      
      Found 1 deadlock.
      

        1. deadlock.txt
          37 kB
          Toshiya Kobayashi

              mfusco@redhat.com Mario Fusco
              rhn-support-tkobayas Toshiya Kobayashi
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: