Bug 814415 - NullPointerException occurs when newInstance property is set to false for the KnowledgeAgentConfiguration
NullPointerException occurs when newInstance property is set to false for the...
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRE (Expert, Fusion) (Show other bugs)
BRMS 5.3.0.GA
Unspecified Unspecified
high Severity high
: ER7
: BRMS 5.3.0.GA
Assigned To: Edson Tirelli
Radovan Synek
Depends On: 813547
  Show dependency treegraph
Reported: 2012-04-19 16:13 EDT by Alessandro Lazarotti
Modified: 2013-10-07 20:55 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
When a rule with a sliding window and pending scheduled event expirations was removed from or replaced on the knowledge base, the engine was not properly cleaning the pending event expirations, and a NullPointerException was raised when the expiration was about to be executed. The engine is now properly cleaning up pending expirations when the rule is removed or replaced, and no more exceptions are raised.
Story Points: ---
Clone Of: 813547
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Test case demonstrating the issue still after BRMS 5.3.0 release (4.84 KB, text/x-java)
2012-08-22 16:13 EDT, Alessandro Lazarotti
no flags Details

  None (edit)
Description Alessandro Lazarotti 2012-04-19 16:13:23 EDT
+++ This bug was initially created as a clone of Bug #813547 +++

When the "drools.agent.newInstance" property is set to false, the client application which uses the KnowledgeAgent to recognize changes/ updates performed in KnowledgeBase throws an exception. It is thrown after changing a temporal rule and building the package: 

Exception in thread "main" org.drools.RuntimeDroolsException: Unexpected exception executing action org.drools.rule.SlidingTimeWindow$BehaviorExpireWMAction@5e53bbfa
	at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1001)
	at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:734)
	at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:701)
	at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
	at com.sample.ExecutarAgente.main(ExecutarAgente.java:62)
Caused by: java.lang.NullPointerException
	at org.drools.rule.SlidingTimeWindow.isExpired(SlidingTimeWindow.java:192)
	at org.drools.rule.SlidingTimeWindow.expireTuples(SlidingTimeWindow.java:161)

*We are creating a test case to reproduce this bug.

--- Additional comment from alazarot@redhat.com on 2012-04-18 11:03:17 EDT ---

Created attachment 578380 [details]
Test case

I've added a test case for this issue.
If necessary I can add it to drools test suite too. Please validate if it fits to going to code base.
Comment 1 Rick Wagner 2012-04-19 16:19:13 EDT
GSS considers this an important addition to BRMS 5.3, as it is being fixed in 5.2 and we don't want a regression.


Comment 2 Edson Tirelli 2012-04-25 11:26:38 EDT
This was committed to all branches: 5.2, 5.3, 5.4 and master (5.5).

Comment 3 Ryan Zhang 2012-05-14 04:17:21 EDT
The fixed for this issue should be included in ER7. Please do verification on it.
Comment 5 Lukáš Petrovický 2012-05-22 04:45:38 EDT
The fix is in and the tests do not fail. VERIFIED.
Comment 6 Alessandro Lazarotti 2012-08-21 08:55:18 EDT
Customer is still facing the issue on BRMS 5.3.1.
I will attach a new test case ASAP
Comment 7 Alessandro Lazarotti 2012-08-22 16:13:05 EDT
Created attachment 606373 [details]
Test case demonstrating the issue still after BRMS 5.3.0 release

Attached a new test case demonstrating the issue still after BRMS 5.3.0 release
Comment 8 Alessandro Lazarotti 2012-08-22 16:35:11 EDT
Edson, do you need a pull request about the attached test case or just it here is enough?
Comment 9 Edson Tirelli 2012-08-27 13:10:49 EDT
Alessandro, thank you, the attached case allowed me to see the remaining issue. The engine was not properly cleaning up scheduled event expiration for events that belonged to sliding windows, when the rule was removed or replaced/updated.

This is fixed now, test case was updated. 

<jbossbot> git [drools] push 5.3.x f10b9d1.. Edson Tirelli JBRULES-3467: BZ-813547: BZ-814415: the engine was not cleaning up scheduled expirations for events in sliding windows when removing or replacing an existing rule. Fixed, test case updated.
<jbossbot> jira [JBRULES-3467] NullPointerException occurs when newInstance property is set to false for the KnowledgeAgentConfiguration [Closed (Done) Bug, Major, Edson Tirelli] https://issues.jboss.org/browse/JBRULES-3467
<jbossbot> git [drools] push 5.3.x URL: http://github.com/droolsjbpm/drools/compare/fe70276...f10b9d1
Comment 12 Radovan Synek 2012-09-14 11:00:35 EDT
Verified on 5.3.1.BRMS-ER1

Note You need to log in before you can comment on or make changes to this bug.