Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-69384

SerenityPointGenerator.hasReport fails on JDK17 for GlobalListener

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • influxdb-plugin
    • 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.

          [JENKINS-69384] SerenityPointGenerator.hasReport fails on JDK17 for GlobalListener

          Fabian Knittel created issue -
          Fabian Knittel made changes -
          Description Original: 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:
          {noformat}
          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)  {noformat}
          This appears to be caused by [InfluxDbPublicationService.java#L253|https://github.com/jenkinsci/influxdb-plugin/blob/420a2a9d6415f9dc0533ac3cd74e457ab653a5bc/src/main/java/jenkinsci/plugins/influxdb/InfluxDbPublicationService.java#L253] accessing {{env.get("WORKSPACE")}} which appears to be null outside of an agent block. [InfluxDbPublicationService.java#L255|https://github.com/jenkinsci/influxdb-plugin/blob/420a2a9d6415f9dc0533ac3cd74e457ab653a5bc/src/main/java/jenkinsci/plugins/influxdb/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|https://github.com/jenkinsci/influxdb-plugin/blob/420a2a9d6415f9dc0533ac3cd74e457ab653a5bc/src/main/java/jenkinsci/plugins/influxdb/generators/serenity/SerenityJsonSummaryFile.java#L19] to also check the workspace field for non-null or to safeguard the the Serenity-related code within [InfluxDbPublicationService|https://github.com/jenkinsci/influxdb-plugin/blob/420a2a9d6415f9dc0533ac3cd74e457ab653a5bc/src/main/java/jenkinsci/plugins/influxdb/InfluxDbPublicationService.java#L253].
          New: 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:
          {noformat}
          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){noformat}
          This appears to be caused by [InfluxDbPublicationService.java#L253|https://github.com/jenkinsci/influxdb-plugin/blob/420a2a9d6415f9dc0533ac3cd74e457ab653a5bc/src/main/java/jenkinsci/plugins/influxdb/InfluxDbPublicationService.java#L253] accessing {{env.get("WORKSPACE")}} which appears to be null outside of an agent block. [InfluxDbPublicationService.java#L255|https://github.com/jenkinsci/influxdb-plugin/blob/420a2a9d6415f9dc0533ac3cd74e457ab653a5bc/src/main/java/jenkinsci/plugins/influxdb/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|https://github.com/jenkinsci/influxdb-plugin/blob/420a2a9d6415f9dc0533ac3cd74e457ab653a5bc/src/main/java/jenkinsci/plugins/influxdb/generators/serenity/SerenityJsonSummaryFile.java#L19] to also check the workspace field for non-null or to safeguard the the Serenity-related code within [InfluxDbPublicationService|https://github.com/jenkinsci/influxdb-plugin/blob/420a2a9d6415f9dc0533ac3cd74e457ab653a5bc/src/main/java/jenkinsci/plugins/influxdb/InfluxDbPublicationService.java#L253].
          Aleksi Simell made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Aleksi Simell made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Aleksi Simell made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Fixed but Unreleased [ 10203 ]
          Aleksi Simell made changes -
          Released As New: 3.5
          Status Original: Fixed but Unreleased [ 10203 ] New: Resolved [ 5 ]
          Aleksi Simell made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Aleksi Simell made changes -
          Released As Original: 3.5 New: 3.6
          Resolution New: Fixed [ 1 ]
          Status Original: Reopened [ 4 ] New: Closed [ 6 ]

            aleksisimell Aleksi Simell
            fknittel Fabian Knittel
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: