[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2346) insert: ConcurrentModificationException on iterate of ObjectTypeConfigurationRegistry#typeConfMap.

Kateryna Rudenko (JIRA) jira-events at lists.jboss.org
Wed Jan 20 08:02:47 EST 2010


    [ https://jira.jboss.org/jira/browse/JBRULES-2346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12507194#action_12507194 ] 

Kateryna Rudenko commented on JBRULES-2346:
-------------------------------------------

There is also ConcurrentModificationException in ClassFieldAccessorCache$CacheEntry. We cannot reproduce it in UTs, but, most likely, attached fix works. ConcurrentHashMap is used instead of HashMap.
 Stack trace is:
ConcurrentModificationException: concurrent access to HashMap attempted by Thread[http-0.0.0.0-25207-7,5,jboss]
   at java.util.HashMap.onEntry(HashMap.java:214)
   at java.util.HashMap.transfer(HashMap.java:686)
   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.base.ClassFieldAccessorCache$CacheEntry.getClassObjectType(ClassFieldAccessorCache.java:351)
   at org.drools.base.ClassFieldAccessorCache.getClassObjectType(ClassFieldAccessorCache.java:195)
   at org.drools.reteoo.ClassObjectTypeConf.<init>(ClassObjectTypeConf.java:70)
   at org.drools.common.ObjectTypeConfigurationRegistry.getObjectTypeConf(ObjectTypeConfigurationRegistry.java:59)
   at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:849)
   at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:114)
   at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:108)
   at sun.reflect.GeneratedMethodAccessor499.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:618)
   at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:931)
   at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:316)
   at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:138)
   at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:133)
   at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
   at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:104)
   at org.mvel2.MVEL.executeExpression(MVEL.java:978)
   at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:87)
   at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
   at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
   at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)
   at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660)
   at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:637)
   at com.softcomputer.rbs.RbsSession.execute(RbsSession.java:133)
   at com.softcomputer.softlab.rnv.rbs.RnvRbsService.fireAll_aroundBody4(RnvRbsService.java:170)
   at com.softcomputer.softlab.rnv.rbs.RnvRbsService.fireAll_aroundBody5$advice(RnvRbsService.java:50)
   at com.softcomputer.softlab.rnv.rbs.RnvRbsService.fireAll(RnvRbsService.java:1)
   at com.softcomputer.softlab.rnv.rbs.RnvRbsService.processRules_aroundBody0(RnvRbsService.java:87)
   at com.softcomputer.softlab.rnv.rbs.RnvRbsService.processRules_aroundBody1$advice(RnvRbsService.java:50)
   at com.softcomputer.softlab.rnv.rbs.RnvRbsService.processRules(RnvRbsService.java:1)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:618)
   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
   at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)

> insert: ConcurrentModificationException on iterate of ObjectTypeConfigurationRegistry#typeConfMap.
> --------------------------------------------------------------------------------------------------
>
>                 Key: JBRULES-2346
>                 URL: https://jira.jboss.org/jira/browse/JBRULES-2346
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-core
>    Affects Versions: 5.0.1.FINAL
>            Reporter: Olexandr Demura
>            Assignee: Mark Proctor
>         Attachments: EntryPointNode.java, ObjectTypeConfigurationRegistry.java
>
>
> Very rare exception occurs in multi-threaded environment, each thread processes series of rule evaluations with recreation of StatefulSession after each:
> java.util.ConcurrentModificationException
> 	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:1091)
> 	at java.util.HashMap$ValueIterator.next(HashMap.java:1122)
> 	at org.drools.reteoo.EntryPointNode.updateSink(EntryPointNode.java:285)
> 	at org.drools.reteoo.ObjectTypeNode.attach(ObjectTypeNode.java:279)
> 	at org.drools.reteoo.builder.PatternBuilder.attachObjectTypeNode(PatternBuilder.java:234)
> 	at org.drools.reteoo.ClassObjectTypeConf.<init>(ClassObjectTypeConf.java:93)
> 	at org.drools.common.ObjectTypeConfigurationRegistry.getObjectTypeConf(ObjectTypeConfigurationRegistry.java:58)
> 	at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:849)
> 	at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:114)
> 	at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:108)
> Problem is caused by cyclic dependency.
> ObjectTypeConfigurationRegistry#getObjectTypeConf(EntryPoint, Object)
> creates ClassObjectTypeConf to put into ObjectTypeConfigurationRegistry#typeConfMap,
> creation code relies on EntryPointNode#updateSink(ObjectSink, PropagationContext, InternalWorkingMemory),
> which iterates on ObjectTypeConfigurationRegistry#typeConfMap.
> I can't reproduce it on 5.1.0.M1 now, but because of rare reproduction.
> Source looks like have this bug yet. 
> Used workaround for it:
> EntryPointNode#updateSink(ObjectSink, PropagationContext, InternalWorkingMemory) iterates on copy of ObjectTypeConfigurationRegistry#typeConfMap:
>         for ( ObjectTypeConf objectTypeConf : wmEntryPoint.getObjectTypeConfigurationRegistry().values() ) {
> ->
>         for ( ObjectTypeConf objectTypeConf : new ArrayList<ObjectTypeConf>(
>                 new wmEntryPoint.getObjectTypeConfigurationRegistry().values() )) {

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list