Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3552

ConcurrentModificationException in CompositeClassLoader$CachingLoader in multithreading environment

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.4.0.Final
    • Fix Version/s: None
    • Component/s: drools-api
    • Labels:
      None

      Description

      Sometimes we get this exception when executing rules from multiple threads at first time after application server starts, probably same rule file.

      Here is our environment:
      1. We are using precompiled knowledge base by serialized into file and deserialize it from file when using it;
      2. Use same knowledge base object for all threads;
      3. Call newStatelessKnowledgeSession from same knowledge base for every thread when executing rules;
      4. stateless session is never cached or shared among threads;

      Following are stack trace:

      [java.util.ConcurrentModificationException] concurrent access to HashMap attempted by Thread[ORB.thread.pool :

      3,5,main]
      at java.util.HashMap.onExit(HashMap.java:226)
      at java.util.HashMap.transfer(HashMap.java:690)
      at java.util.HashMap.resize(HashMap.java:676)
      at java.util.HashMap.addEntry(HashMap.java:1049)
      at java.util.HashMap.put(HashMap.java:561)
      at org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:271)
      at org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:237)
      at org.drools.util.CompositeClassLoader.loadClass(CompositeClassLoader.java:88)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:597)
      at java.lang.Class.forNameImpl(Native Method)
      at java.lang.Class.forName(Class.java:163)
      at org.mvel2.ParserConfiguration.checkForDynamicImport(ParserConfiguration.java:159)
      at org.mvel2.ParserConfiguration.hasImport(ParserConfiguration.java:187)
      at org.mvel2.ParserContext.hasImport(ParserContext.java:352)
      at org.mvel2.compiler.PropertyVerifier.getBeanProperty(PropertyVerifier.java:163)
      at org.mvel2.compiler.PropertyVerifier.analyze(PropertyVerifier.java:117)
      at org.mvel2.compiler.ExpressionCompiler.verify(ExpressionCompiler.java:381)
      at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:273)
      at org.mvel2.util.ParseTools.subCompileExpression(ParseTools.java:2137)
      at org.mvel2.ast.Substatement.<init>(Substatement.java:38)
      at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1073)
      at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:128)
      at org.mvel2.util.ParseTools.subCompileExpression(ParseTools.java:2137)
      at org.mvel2.ast.Negation.<init>(Negation.java:40)
      at org.mvel2.compiler.AbstractParser.nextToken(AbstractParser.java:1181)
      at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:128)
      at org.mvel2.compiler.ExpressionCompiler.compile(ExpressionCompiler.java:62)
      at org.mvel2.MVEL.compileExpression(MVEL.java:810)
      at org.drools.base.mvel.MVELCompilationUnit.compile(MVELCompilationUnit.java:442)
      at org.drools.base.mvel.MVELCompilationUnit.getCompiledExpression(MVELCompilationUnit.java:238)
      at org.drools.rule.constraint.MvelConstraint.createMvelConditionEvaluator(MvelConstraint.java:173)
      at org.drools.rule.constraint.MvelConstraint.evaluate(MvelConstraint.java:157)
      at org.drools.rule.constraint.MvelConstraint.isAllowed(MvelConstraint.java:124)
      at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
      at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
      at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
      at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
      at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
      at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:337)
      at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298)
      at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:888)
      at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
      at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
      at org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:303)
      at com.validators.Validator.execute(Validator.java:436)
      at com.ejb.EJBBean.validate(EJBBean.java:122)
      at com.ejb._EJSRemote0SLEJBBean_3a6166f4_Tie.validate(_EJSRemote0SLEJBBean_3a6166f4_Tie.java)
      at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:621)
      at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:474)
      at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
      at com.ibm.CORBA.iiop.ORB.process(ORB.java:1571)
      at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2703)
      at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2577)
      at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
      at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1551)

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mark.proctor Mark Proctor
                Reporter:
                peter2012 Peter P
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: