[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2346) insert: ConcurrentModificationException on iterate of ObjectTypeConfigurationRegistry#typeConfMap.
Olexandr Demura (JIRA)
jira-events at lists.jboss.org
Mon Nov 30 10:19:29 EST 2009
[ https://jira.jboss.org/jira/browse/JBRULES-2346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12497230#action_12497230 ]
Olexandr Demura commented on JBRULES-2346:
------------------------------------------
One more exception, this time about unsynchronized access to EntryPointNode#objectTypeNodes:
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.ClassObjectTypeConf.getMatchingObjectTypes(ClassObjectTypeConf.java:171)
at org.drools.reteoo.ClassObjectTypeConf.getObjectTypeNodes(ClassObjectTypeConf.java:163)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:143)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001)
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:114)
at org.drools.base.DefaultKnowledgeHelper.insert(DefaultKnowledgeHelper.java:108)
`insert` in both cases is called by reflection from mvel-compiled rule.
Several rules make insertion of all noticeable objects on object graph recursively.
Several threads share RuleAgent and RuleBase, but StatefullSession is recreated for each thread (each request).
> 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
>
> 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