Bug 1200784 - KIE-CI: NPE when POM of the artifact being updated not available
Summary: KIE-CI: NPE when POM of the artifact being updated not available
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: BRE
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: DR1
: 6.2.0
Assignee: Mario Fusco
QA Contact: Marek Winkler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-03-11 11:42 UTC by Marek Winkler
Modified: 2020-03-27 19:12 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-03-27 19:12:04 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Standalone reproducer project (5.29 KB, application/zip)
2015-03-11 15:20 UTC, Marek Winkler
no flags Details

Description Marek Winkler 2015-03-11 11:42:15 UTC
Description of problem:

When KieScanner is being created around a KieContainer using KieModule which has not been deployed into local Maven repository (nor its POM is otherwise accessible to KieScanner), KieScanner reverts to parsing pom.xml of the test project it is running in (i.e. drools-compiler). This pom.xml fails to be parsed by native Maven POM parser, which leads to (probably) incorrectly initialized KieModule's dependencies resulting in the following NPE:

java.lang.NullPointerException: null
	at org.kie.scanner.embedder.EmbeddedPomParser.getPomDirectDependencies(EmbeddedPomParser.java:27)
	at org.kie.scanner.ArtifactResolver.getPomDirectDependencies(ArtifactResolver.java:59)
	at org.kie.scanner.ArtifactResolver.getAllDependecies(ArtifactResolver.java:64)
	at org.kie.scanner.KieRepositoryScannerImpl.indexAtifacts(KieRepositoryScannerImpl.java:329)
	at org.kie.scanner.KieRepositoryScannerImpl.setKieContainer(KieRepositoryScannerImpl.java:73)
	at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieScanner(KieServicesImpl.java:115)
	at org.kie.scanner.KieRepositoryScannerTest.testKScannerStartNotDeployed(KieRepositoryScannerTest.java:103)

Please be aware that the same NPE (although with a slightly different stacktrace) is thrown if the artifact is being redeployed into local Maven repository while KieScanner is scanning it (concurrency issue). This is quite serious because the KieScanner thread then stops scanning for new updates:

Exception in thread "Timer-0" java.lang.NullPointerException
	at org.kie.scanner.embedder.EmbeddedPomParser.getPomDirectDependencies(EmbeddedPomParser.java:27)
	at org.kie.scanner.ArtifactResolver.getPomDirectDependencies(ArtifactResolver.java:59)
	at org.kie.scanner.ArtifactResolver.getAllDependecies(ArtifactResolver.java:64)
	at org.kie.scanner.KieRepositoryScannerImpl.scanForUpdates(KieRepositoryScannerImpl.java:309)
	at org.kie.scanner.KieRepositoryScannerImpl.scanNow(KieRepositoryScannerImpl.java:253)
	at org.kie.scanner.KieRepositoryScannerImpl$ScanTask.run(KieRepositoryScannerImpl.java:242)
	at java.util.TimerThread.mainLoop(Timer.java:555)
	at java.util.TimerThread.run(Timer.java:505)


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

How reproducible:
always (the first NPE)

Steps to Reproduce:
1. run the test from the attached pull request

Actual results:
Test fails with NPE.

Expected results:
Test succeeds.

Additional info:
I have prepared reproducer for the first "stacktrace" of the NPE, as it is 100 % reproducible. If you needed, I can attach standalone reproducer for the second one, or test the fix myself.

Comment 1 Marek Winkler 2015-03-11 11:43:59 UTC
The problem appeared in test scenario made available by fixing BZ 1190903, but it is not limited to that.

Comment 2 Marek Winkler 2015-03-11 11:50:14 UTC
Pull request with reproducer: https://github.com/droolsjbpm/drools/pull/417

Comment 3 Marek Winkler 2015-03-11 12:10:46 UTC
There is another NPE which I am trying to prepare a reliable reproducer for, Mario asked me to mention it here. If I succeed with isolating it, it is very likely there will be a new BZ for it.


java.lang.NullPointerException: null
	at org.drools.compiler.kie.util.ChangeSetBuilder.build(ChangeSetBuilder.java:52)
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.update(KieContainerImpl.java:129)
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.updateDependencyToVersion(KieContainerImpl.java:117)
	at org.kie.scanner.KieRepositoryScannerImpl.updateKieModule(KieRepositoryScannerImpl.java:289)
	at org.kie.scanner.KieRepositoryScannerImpl.scanNow(KieRepositoryScannerImpl.java:270)
	at org.jboss.qa.brms.bre.functional.KieScannerTest.startScanTwoKieBasesTest(KieScannerTest.java:464)

Comment 4 Marek Winkler 2015-03-11 15:20:04 UTC
Created attachment 1000541 [details]
Standalone reproducer project

Attaching standalone reproducer project illustrating the NPE in case 2) from the description. Please unzip and run

  mvn clean install -s settings.xml -Dkie.maven.settings.custom=settings.xml

The issue is not 100 % reproducible, though. I was able to get around 75 % probability of reproducing the NPE with OpenJDK 7.

Comment 7 Mario Fusco 2015-03-20 12:40:40 UTC
Fixed by https://github.com/droolsjbpm/drools/commit/cbd266d04

Comment 8 Marek Winkler 2015-10-08 14:44:44 UTC
Verified in BRMS 6.2.0 ER3.


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