-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Eclipse Temurin JDK 17, influxdb-plugin 3.3, Jenkins 2.346.3, Linux
-
-
3.6
We attempted to update our Jenkins instance from JDK11 to JDK17 (using the Docker image, so switching from jenkins/jenkins:lts-jdk11 to jenkins/jenkins:lts-jdk17), but this caused a regression in the influxdb-plugin:
The GlobalListener causes the following exception on job completion for pipeline jobs:
2022-08-11T15:07:22.444+02:00 2022-08-11 13:07:22.444+0000 [id=1370] INFO o.j.p.workflow.job.WorkflowRun#finish: eop-jenkins-integrationtest #1460 completed: SUCCESS 2022-08-11T15:07:22.460+02:00 2022-08-11 13:07:22.459+0000 [id=1370] WARNING jenkins.util.Listeners#lambda$notify$0 2022-08-11T15:07:22.460+02:00 java.lang.NullPointerException 2022-08-11T15:07:22.460+02:00 at java.base/java.util.Objects.requireNonNull(Objects.java:208) 2022-08-11T15:07:22.460+02:00 at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:263) 2022-08-11T15:07:22.460+02:00 at java.base/java.nio.file.Path.of(Path.java:147) 2022-08-11T15:07:22.460+02:00 at java.base/java.nio.file.Paths.get(Paths.java:69) 2022-08-11T15:07:22.460+02:00 at jenkinsci.plugins.influxdb.generators.serenity.SerenityJsonSummaryFile.getPath(SerenityJsonSummaryFile.java:24) 2022-08-11T15:07:22.460+02:00 at jenkinsci.plugins.influxdb.generators.serenity.SerenityJsonSummaryFile.exists(SerenityJsonSummaryFile.java:20) 2022-08-11T15:07:22.460+02:00 at jenkinsci.plugins.influxdb.generators.serenity.SerenityPointGenerator.hasReport(SerenityPointGenerator.java:70) 2022-08-11T15:07:22.460+02:00 at jenkinsci.plugins.influxdb.InfluxDbPublicationService.perform(InfluxDbPublicationService.java:255) 2022-08-11T15:07:22.460+02:00 at jenkinsci.plugins.influxdb.global.GlobalRunListener.onCompleted(GlobalRunListener.java:75) 2022-08-11T15:07:22.460+02:00 at hudson.model.listeners.RunListener.lambda$fireCompleted$0(RunListener.java:207) 2022-08-11T15:07:22.460+02:00 at jenkins.util.Listeners.lambda$notify$0(Listeners.java:59) 2022-08-11T15:07:22.460+02:00 at jenkins.util.Listeners.notify(Listeners.java:67) 2022-08-11T15:07:22.460+02:00 at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:205) 2022-08-11T15:07:22.460+02:00 at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:627) 2022-08-11T15:07:22.460+02:00 at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$800(WorkflowRun.java:138) 2022-08-11T15:07:22.460+02:00 at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:1049) 2022-08-11T15:07:22.460+02:00 at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1518) 2022-08-11T15:07:22.460+02:00 at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:509) 2022-08-11T15:07:22.460+02:00 at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:38) 2022-08-11T15:07:22.460+02:00 at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139) 2022-08-11T15:07:22.460+02:00 at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) 2022-08-11T15:07:22.460+02:00 at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) 2022-08-11T15:07:22.460+02:00 at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) 2022-08-11T15:07:22.460+02:00 at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 2022-08-11T15:07:22.460+02:00 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) 2022-08-11T15:07:22.460+02:00 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) 2022-08-11T15:07:22.460+02:00 at java.base/java.lang.Thread.run(Thread.java:833)
This appears to be caused by InfluxDbPublicationService.java#L253 accessing env.get("WORKSPACE") which appears to be null outside of an agent block. InfluxDbPublicationService.java#L255 then attempts to check the existence of the SerenityJsonSummaryFile, which effectively causes java.nio.file.Paths.get(null, "target/site/serenity", "serenity-summary.json") to be evaluated.
With JDK11 this results in the path "null/target/site/serenity/serenity-summary.json", while JDK17 throws NullPointerException.
I suggest to either modify the SerenityJsonSummaryFile.exists() method to also check the workspace field for non-null or to safeguard the the Serenity-related code within InfluxDbPublicationService.