Created attachment 640180 [details] NPE stack trace. Description of problem: The AccumulateNode.getFirstMatch() throws NPE when some already collected event expires. The problem occurs when thread A is running StatefulKnowledgeSession.fireUntilHalt() while thread B is inserting new events into the session. The problem occurs when @expires is defined on the event. The lower the @expires value, the more likely the NPE occurs. Version-Release number of selected component (if applicable): 5.3.1.BRMS-ER4 (verified on Drools 5.3.x branch) How reproducible: Will attach a link to pull request with a reproducer test. Steps to Reproduce: 1. Run the test in org.drools.integrationtests.FireUntilHaltAccumulateTest Actual results: With a very high probability the NPE is thrown. Expected results: The test runs without throwing an exception.
Pull request with test case is located at: https://github.com/droolsjbpm/drools/pull/163
Edson Tirelli <ed.tirelli> made a comment on jira DROOLS-70 Mario, I've been unable to reproduce this so far. I've run the test you created a ton of times in a loop, but I can't reproduce the error in an i7 cpu. In any case, the problem here is that event expiration is a WMA, so it shouldn't happen concurrently with any other WMA action (like the insertion of new facts). If it is happening, then the locks in the session are not being properly handled.