[jboss-jira] [JBoss JIRA] (DROOLS-2313) Bad synchronization of ClassAwareObjectStore list of concreteStores can cause ConcurrentModificationException or ArrayIndexOutOfBoundsException while getting session objects
Donatien RIVIERE (Jira)
issues at jboss.org
Wed Dec 12 06:55:00 EST 2018
[ https://issues.jboss.org/browse/DROOLS-2313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13673684#comment-13673684 ]
Donatien RIVIERE commented on DROOLS-2313:
------------------------------------------
Thank you !
> Bad synchronization of ClassAwareObjectStore list of concreteStores can cause ConcurrentModificationException or ArrayIndexOutOfBoundsException while getting session objects
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: DROOLS-2313
> URL: https://issues.jboss.org/browse/DROOLS-2313
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.5.0.Final, 7.6.0.Final
> Reporter: Donatien RIVIERE
> Assignee: Mario Fusco
> Priority: Major
> Attachments: KieSessionConcurrentTest.java
>
>
> If a thread requests for session objects (using kieSession.getObjects() with or without filters) while another one is inserting objects +*of different concrete classes*+, there is a chance that a new ConcreteObjectStore is added to the concreteStores list at the same time and cause concurrent exception.
> Example when using kieSession.getObjects().*iterator()* :
> {noformat}
> Exception in thread "QueryingThread" java.util.ConcurrentModificationException
> at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
> at java.util.ArrayList$Itr.next(ArrayList.java:851)
> at org.drools.core.common.ClassAwareObjectStore$CompositeObjectIterator.fetchNextIterator(ClassAwareObjectStore.java:556)
> at org.drools.core.common.ClassAwareObjectStore$AbstractCompositeIterator.nextIterator(ClassAwareObjectStore.java:513)
> at org.drools.core.common.ClassAwareObjectStore$AbstractCompositeIterator.fetchNext(ClassAwareObjectStore.java:499)
> at org.drools.core.common.ClassAwareObjectStore$AbstractCompositeIterator.<init>(ClassAwareObjectStore.java:494)
> at org.drools.core.common.ClassAwareObjectStore$AbstractCompositeIterator.<init>(ClassAwareObjectStore.java:487)
> at org.drools.core.common.ClassAwareObjectStore$AbstractCompositeIterator.<init>(ClassAwareObjectStore.java:478)
> at org.drools.core.common.ClassAwareObjectStore$CompositeObjectIterator.<init>(ClassAwareObjectStore.java:546)
> at org.drools.core.common.ClassAwareObjectStore$CompositeObjectIterator.<init>(ClassAwareObjectStore.java:544)
> at org.drools.core.common.ClassAwareObjectStore.iterateObjects(ClassAwareObjectStore.java:186)
> at org.drools.core.impl.StatefulKnowledgeSessionImpl$ObjectStoreWrapper.iterator(StatefulKnowledgeSessionImpl.java:679)
> at org.drools.core.impl.StatefulKnowledgeSessionImpl$ObjectStoreWrapper.toArray(StatefulKnowledgeSessionImpl.java:710)
> at org.drools.core.impl.StatefulKnowledgeSessionImpl$ObjectStoreWrapper.toArray(StatefulKnowledgeSessionImpl.java:695)
> at ft.drools.KieSessionConcurrentTest.lambda$0(KieSessionConcurrentTest.java:125)
> {noformat}
> Example when using kieSession.getObjects().*toArray()* :
> {noformat}
> Exception in thread "QueryingThread" java.lang.ArrayIndexOutOfBoundsException: 1
> at org.drools.core.impl.StatefulKnowledgeSessionImpl$ObjectStoreWrapper.toArray(StatefulKnowledgeSessionImpl.java:711)
> at org.drools.core.impl.StatefulKnowledgeSessionImpl$ObjectStoreWrapper.toArray(StatefulKnowledgeSessionImpl.java:695)
> at ft.drools.KieSessionConcurrentTest.lambda$0(KieSessionConcurrentTest.java:125)
> {noformat}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the jboss-jira
mailing list