Bug 814415

Summary: NullPointerException occurs when newInstance property is set to false for the KnowledgeAgentConfiguration
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Alessandro Lazarotti <alazarot>
Component: BRE (Expert, Fusion)Assignee: Nobody <nobody>
Status: VERIFIED --- QA Contact: Radovan Synek <rsynek>
Severity: high Docs Contact:
Priority: high    
Version: BRMS 5.3.0.GACC: ajuricic, alazarot, atangrin, rwagner
Target Milestone: ER7   
Target Release: BRMS 5.3.0.GA   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 813547    
Bug Blocks:    
Attachments:
Description Flags
Test case demonstrating the issue still after BRMS 5.3.0 release none

Description Alessandro Lazarotti 2012-04-19 20:13:23 UTC
+++ 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 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 20:19:13 UTC
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.

Thanks,

Rick

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

https://bugzilla.redhat.com/show_bug.cgi?id=813547

Comment 3 Ryan Zhang 2012-05-14 08:17:21 UTC
The fixed for this issue should be included in ER7. Please do verification on it.

Comment 5 Lukáš Petrovický 2012-05-22 08:45:38 UTC
The fix is in and the tests do not fail. VERIFIED.

Comment 6 Alessandro Lazarotti 2012-08-21 12:55:18 UTC
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 20:13:05 UTC
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 20:35:11 UTC
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 17:10:49 UTC
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 15:00:35 UTC
Verified on 5.3.1.BRMS-ER1