Bug 1190903 - NPE when trying to access modified Rule associated with a non-default session
Summary: NPE when trying to access modified Rule associated with a non-default session
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: unspecified
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ER5
: 6.1.0
Assignee: Mario Fusco
QA Contact: Marek Winkler
URL:
Whiteboard:
Depends On:
Blocks: 1194482 1195464
TreeView+ depends on / blocked
 
Reported: 2015-02-09 23:10 UTC by William Antônio
Modified: 2020-03-27 20:10 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1194482 1195464 (view as bug list)
Environment:
Last Closed: 2020-03-27 20:10:45 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
A reproducer for this issue (14.97 KB, application/x-gzip)
2015-02-09 23:10 UTC, William Antônio
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker DROOLS-511 0 Major Resolved KieContainerImpl.updateResourcesIncrementally throws NullPointerException when a package doesn't exist 2017-01-12 07:57:21 UTC

Description William Antônio 2015-02-09 23:10:12 UTC
Created attachment 989896 [details]
A reproducer for this issue

Description of problem:

Let's say in our KJAR we have two rules and one is associated with the default session, and a client application keeps pulling the latest changes from the module.

When we modify the rule not associated with the default session, we have a NPE on the client.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
(see attachment)
1) build and install the kjar maven project(bpms.test.01337004.kjar):
   mvn clean install

2) build and run the maven test in the project bpms.test.01337004.client:
   mvn clean package (or mvn clean test)

   it should fire the "myTestRule" and show the printout "Version 3.0 Test build.Repeat-rebuild-test" in the console.

3) change the "myTestRule", for example 
   change
      "Version 3.0 Test build.Repeat-rebuild-test"
   to
      "Version 4.0 Test build.Repeat-rebuild-test"
   and rebuild kjar by running
   mvn clean install

   the client started in step 2) should pick up the change and show the printout "Version 4.0 Test build.Repeat-rebuild-test" in the console

4) change the "mytest2" and rebuild the kjar
   mvn clean install

   the NPE error should show in the console:

   Exception in thread "Timer-0" java.lang.NullPointerException
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.updateResourcesIncrementally(KieContainerImpl.java:269)
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.update(KieContainerImpl.java:161)
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.updateDependencyToVersion(KieContainerImpl.java:114)
	at org.kie.scanner.KieRepositoryScannerImpl.updateKieModule(KieRepositoryScannerImpl.java:231)
	at org.kie.scanner.KieRepositoryScannerImpl.scanNow(KieRepositoryScannerImpl.java:218)
	at org.kie.scanner.KieRepositoryScannerImpl$ScanTask.run(KieRepositoryScannerImpl.java:198)
	at java.util.TimerThread.mainLoop(Timer.java:555)
	at java.util.TimerThread.run(Timer.java:505)


After this error pops up, any change made to the two rules mentioned above will not be picked up. 


Please note that the first rule "myTestRule" is associated with the default kieSession:
   <kbase name="kbase_test" packages="org.redhat.gss.myproject">
    <ksession name="ksession1" default="true" type="stateful" />
  </kbase>

The second rule "mytest2" is associated with a non-default kieSession:
   <kbase name="kbase_test2" packages="org.redhat.gss.pkg2">
    <ksession name="ksession2"  type="stateful" />
  </kbase>

It seems that any changes made to the non-default kieSession would cause the NPE error.

Actual results:

NPE error.

Expected results:

No error and changes on client.

Comment 3 Alessandro Lazarotti 2015-02-10 02:59:39 UTC
Actually the problem is not due non-default ksession, the problem is a kjar with multiples kbases. If a kbase does not have the package where is the rule changed, the NPE happens.

Comment 4 Alessandro Lazarotti 2015-02-10 03:16:29 UTC
Pull request for 6.0.x: https://github.com/droolsjbpm/drools/pull/405/files
Sorry, I've not verified the issue over 6.2.x and master yet.

Comment 6 Mario Fusco 2015-02-11 11:20:13 UTC
This issue has been already reported here https://issues.jboss.org/browse/DROOLS-511 and fixed with this commit https://github.com/droolsjbpm/drools/commit/913b258c36fc3e304760f46e7be21b65ad16c878

I checked that the provided reproducer works on both master and 6.2.x branches.

Comment 7 Edson Tirelli 2015-02-11 15:18:46 UTC
Setting target milestone to ER5 and target release 6.1.0 as this was already fixed on ER5.

Comment 8 Marek Winkler 2015-02-24 08:38:18 UTC
Verified on BRMS 6.1.0 ER5.


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