Bug 811745

Summary: NPE when used Event types + rules with sliding window + package compiled by BRM (Guvnor)
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Alessandro Lazarotti <alazarot>
Component: BRM (Guvnor)Assignee: manstis
Status: MODIFIED --- QA Contact:
Severity: urgent Docs Contact:
Priority: urgent    
Version: BRMS 5.2.0.GACC: rwagner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 814409 (view as bug list) Environment:
Last Closed: Type: Support Patch
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 814409, 812707    
Attachments:
Description Flags
repository export containing a test scenario reproducing the issue
none
based drl file
none
pojo model
none
test scenario printscreen
none
pkg generated by guvnor none

Description Alessandro Lazarotti 2012-04-11 20:50:39 UTC
Packages compiled by BRM (Guvnor) ignore Event types, so if a rule uses sliding window a NPE is throwed:
h
java.lang.NullPointerException
at org.drools.reteoo.ReteooFactHandleFactory.newFactHandle(ReteooFactHandleFactory.java:56)
at org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:80)
at org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:65)
at org.drools.common.NamedEntryPoint.createHandle(NamedEntryPoint.java:705)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:282)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:905)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:864)
at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
at john.DroolsError.runRules(DroolsError.java:48)
at john.DroolsError.main(DroolsError.java:40) 

Packages compiled by BRM (Guvnor) ignore Event types, so if a rule uses sliding window a NPE is throwed:

java.lang.NullPointerException
at org.drools.reteoo.ReteooFactHandleFactory.newFactHandle(ReteooFactHandleFactory.java:56)
at org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:80)
at org.drools.common.AbstractFactHandleFactory.newFactHandle(AbstractFactHandleFactory.java:65)
at org.drools.common.NamedEntryPoint.createHandle(NamedEntryPoint.java:705)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:282)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:905)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:864)
at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:255)
at john.DroolsError.runRules(DroolsError.java:48)
at john.DroolsError.main(DroolsError.java:40) 

That does not happen if used KnowledgeBuilder and a regular drl file instead of KnowledgeAgent + package binaries from Guvnor.
It can be checked by test scenarios as well. Attached here a repository that reproduces this issue, there is a test scenario in the package "cep" which simulate this situation.

Comment 1 Alessandro Lazarotti 2012-04-11 20:53:13 UTC
Created attachment 576889 [details]
repository export containing a test scenario reproducing the issue

Comment 2 Alessandro Lazarotti 2012-04-23 21:57:24 UTC
Created attachment 579703 [details]
based drl file

Comment 3 Alessandro Lazarotti 2012-04-23 21:59:46 UTC
Created attachment 579704 [details]
pojo model

Comment 4 Alessandro Lazarotti 2012-04-23 22:01:26 UTC
Created attachment 579705 [details]
test scenario printscreen

Comment 7 Alessandro Lazarotti 2012-04-24 15:39:41 UTC
Created attachment 579896 [details]
pkg generated by guvnor

Comment 8 Edson Tirelli 2012-04-24 18:36:30 UTC
We found the problem and discussed the solutions with the Guvnor team. Expect to have this fixed over the next couple days, as the Guvnor team would like to assess the whole impact it will have on existing deployments before delivering.

Comment 9 Edson Tirelli 2012-04-25 14:07:23 UTC
The core engine fix is committed and published. Michael is now making sure the guvnor part of the fix is correct and he will let us know when it is done. The commits for the core engine are:


[drools] etirelli pushed 1 new commit to 5.2.x: https://github.com/droolsjbpm/drools/commit/611c993305ffbe1d0eb846351d58dc626d50a3cf
[drools/5.2.x] JBRULES-3145 BZ-811745: improving the agent code to handle different types of serialized packages - Edson Tirelli
[drools] etirelli pushed 1 new commit to 5.3.x: https://github.com/droolsjbpm/drools/commit/5802f2e7b784712eb85dba6d0dcf4d1443f0e434
[drools/5.3.x] JBRULES-3145 BZ-811745: improving the agent code to handle different types of serialized packages - Edson Tirelli
[drools] etirelli pushed 1 new commit to 5.4.x: https://github.com/droolsjbpm/drools/commit/0ba64ba4d15b7827a84af617dfc2ed918deb52de
[drools/5.4.x] JBRULES-3145 BZ-811745: improving the agent code to handle different types of serialized packages - Edson Tirelli
[drools] etirelli pushed 1 new commit to master: https://github.com/droolsjbpm/drools/commit/5fadf55cf97c0d6a9f3ecddfb29e316f7f3f4b8f
[drools/master] JBRULES-3145 BZ-811745: improving the agent code to handle different types of serialized packages - Edson Tirelli

Comment 10 JBoss JIRA Server 2012-04-25 21:38:18 UTC
Edson Tirelli <ed.tirelli> updated the status of jira JBRULES-3145 to Resolved

Comment 11 JBoss JIRA Server 2012-04-25 21:38:33 UTC
Edson Tirelli <ed.tirelli> updated the status of jira JBRULES-3145 to Closed

Comment 12 manstis 2012-04-26 13:52:09 UTC
Guvnor fixes made to branches 5.2.x, 5.3.x, 5.4.x and master.

Comment 13 Lukáš Petrovický 2012-05-02 21:43:00 UTC
Alessandro, could you please explain what is the difference between this one and bug 814409?

Comment 14 Alessandro Lazarotti 2012-05-03 04:34:59 UTC
Hi Lukas. Both is about the same issue.
This BZ has the goal to fix the issue on the next BRMS 5.2 Roll-Up Patch (look 	812707 in the "Blocks" list ). 

The bug 814409 is a clone of this, to cherry pick the fix to BRMS 5.3. When GSS needs a patch.

When GSS needs a support patch, we need to guarantee that it will be fixed on: 
1) Customer version (sent by one-off or roll-up) - Bug 811745 
2) Next product version - Bug 814409 
3) Upstream - JBRULES-3145

Regards

Comment 15 Alessandro Lazarotti 2012-05-03 04:38:32 UTC
Hi Lukas. Both are about the same issue.
This BZ has the goal to fix the issue on the next BRMS 5.2 Roll-Up Patch (look 
812707 in the "Blocks" list ). 

The bug 814409 is a clone of this, to cherry pick the fix to BRMS 5.3.

When GSS needs a support patch, we need to guarantee that it will be fixed on: 
1) Customer version (sent by one-off or roll-up) - Bug 811745 
2) Next product version - Bug 814409 
3) Upstream - JBRULES-3145

Regards