[jboss-jira] [JBoss JIRA] Commented: (JBRULES-1432) Queries Executed while Rules are Firing Causes Exceptions
Steve Shabino (JIRA)
jira-events at lists.jboss.org
Wed Jan 23 17:05:21 EST 2008
[ http://jira.jboss.com/jira/browse/JBRULES-1432?page=comments#action_12396467 ]
Steve Shabino commented on JBRULES-1432:
----------------------------------------
Upon a bit of inspection, it seems that AbstractFactHandleFactory's newFactHandle() method is not threadsafe:
public final InternalFactHandle newFactHandle( final Object object, final boolean isEvent, long duration, final WorkingMemory workingMemory ) {
if ( !this.factHandlePool.isEmpty() ) {
return newFactHandle( this.factHandlePool.pop(),
object,
isEvent,
duration,
workingMemory );
}
.......
A pop occurring in another thread after an isEmpty() check would cause the failure described above.
> Queries Executed while Rules are Firing Causes Exceptions
> ---------------------------------------------------------
>
> Key: JBRULES-1432
> URL: http://jira.jboss.com/jira/browse/JBRULES-1432
> Project: JBoss Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Reteoo
> Affects Versions: 4.0.4
> Environment: Sun 1.5.0_04 Windows
> Reporter: Steve Shabino
>
> We have a stateful WM into which we periodically (1) insert new facts and fire rules, and (2) execute queries. Drools fails when we allow query execution in another thread during fireAllRules().
> Set-up:
> - Every 10 seconds, Thread A inserts some facts and calls fireAllRules(). fireAllRules() is never called concurrently with itself.
> - Thread B executes many getQueryResults() calls in series (no concurrency in query execution)
> Our rule base uses shadow facts for all facts and is set up this way:
> conf.setAssertBehaviour(RuleBaseConfiguration.AssertBehaviour.EQUALITY);
> conf.setRemoveIdentities(true);
> conf.setLogicalOverride(RuleBaseConfiguration.LogicalOverride.DISCARD);
> conf.setMaintainTms(true);
> conf.setShadowProxy(true);
> We are making some use of insertLogical().
> Expected:
> - Queries are run against the last consistent truth state, even while fireAllRules() is running.
> Actual Behavior:
> We get this exception:
> Caused by: java.lang.RuntimeException: Unable to pop
> at org.drools.util.PrimitiveLongStack.pop(PrimitiveLongStack.java:63)
> at org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:44)
> at org.drools.reteoo.ReteooWorkingMemory.getQueryResults(ReteooWorkingMemory.java:90)
> This bug occurs under 4.04 and 4.1 Trunk as of 1/22.
> Please let us know if we can provide additional information.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list