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

Olexandr Demura (JIRA) jira-events at lists.jboss.org
Thu Nov 26 06:08:30 EST 2009


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