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

          Jan-Frederik Schmidt added a comment - - edited

          +1 Confirmed. Downgraded to jre11 and everything works

          Jan-Frederik Schmidt added a comment - - edited +1 Confirmed. Downgraded to jre11 and everything works

          Aleksi Simell added a comment -

          Aleksi Simell added a comment - https://github.com/jenkinsci/influxdb-plugin/pull/163 Created to resolve this issue.

          Aleksi Simell added a comment -

          PR merged. Fix will be available in next release.

          Aleksi Simell added a comment - PR merged. Fix will be available in next release.

          Kris Conklin added a comment -

          I am seeing this same issue after upgrading to JRE17 and running plugin version 3.5 which claims to have this fix in it. Is 3.5 supposed to have this fix as I see its still listed as unreleased?

           

          Nov 01, 2023 6:22:27 PM WARNING jenkins.util.Listeners lambda$notify$0null
          java.lang.NullPointerException
          	at java.base/java.util.Objects.requireNonNull(Objects.java:209)
          	at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:263)
          	at java.base/java.nio.file.Path.of(Path.java:147)
          	at java.base/java.nio.file.Paths.get(Paths.java:69)
          	at jenkinsci.plugins.influxdb.generators.serenity.SerenityJsonSummaryFile.getPath(SerenityJsonSummaryFile.java:24)
          	at jenkinsci.plugins.influxdb.generators.serenity.SerenityJsonSummaryFile.exists(SerenityJsonSummaryFile.java:20)
          	at jenkinsci.plugins.influxdb.generators.serenity.SerenityPointGenerator.hasReport(SerenityPointGenerator.java:70)
          	at jenkinsci.plugins.influxdb.InfluxDbPublicationService.perform(InfluxDbPublicationService.java:274)
          	at jenkinsci.plugins.influxdb.global.GlobalRunListener.onCompleted(GlobalRunListener.java:75)
          	at hudson.model.listeners.RunListener.lambda$fireCompleted$0(RunListener.java:207)
          	at jenkins.util.Listeners.lambda$notify$0(Listeners.java:59)
          	at jenkins.util.Listeners.notify(Listeners.java:67)
          	at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:205) 

           

           

          Kris Conklin added a comment - I am seeing this same issue after upgrading to JRE17 and running plugin version 3.5 which claims to have this fix in it. Is 3.5 supposed to have this fix as I see its still listed as unreleased?   Nov 01, 2023 6:22:27 PM WARNING jenkins.util.Listeners lambda$notify$0null java.lang.NullPointerException at java.base/java.util.Objects.requireNonNull(Objects.java:209) at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:263) at java.base/java.nio.file.Path.of(Path.java:147) at java.base/java.nio.file.Paths.get(Paths.java:69) at jenkinsci.plugins.influxdb.generators.serenity.SerenityJsonSummaryFile.getPath(SerenityJsonSummaryFile.java:24) at jenkinsci.plugins.influxdb.generators.serenity.SerenityJsonSummaryFile.exists(SerenityJsonSummaryFile.java:20) at jenkinsci.plugins.influxdb.generators.serenity.SerenityPointGenerator.hasReport(SerenityPointGenerator.java:70) at jenkinsci.plugins.influxdb.InfluxDbPublicationService.perform(InfluxDbPublicationService.java:274) at jenkinsci.plugins.influxdb.global.GlobalRunListener.onCompleted(GlobalRunListener.java:75) at hudson.model.listeners.RunListener.lambda$fireCompleted$0(RunListener.java:207) at jenkins.util.Listeners.lambda$notify$0(Listeners.java:59) at jenkins.util.Listeners.notify(Listeners.java:67) at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:205)    

          Aleksi Simell added a comment -

          conkers87 Yes, the fix is released, but apparently I forgot to change ticket status. I reopened the ticket as I try to solve this issue.

          You're also free to create a PR to resolve this issue. I don't really use serenity myself, so digging into this requires some additional effort.

          Aleksi Simell added a comment - conkers87 Yes, the fix is released, but apparently I forgot to change ticket status. I reopened the ticket as I try to solve this issue. You're also free to create a PR to resolve this issue. I don't really use serenity myself, so digging into this requires some additional effort.

          Kris Conklin added a comment -

          We aren't using Serenity either so I think this is a not using Serenity problem on Java17.

          I will admit to mostly being a noob when it comes to plugins and mostly a C guy so Java isn't my wheelhouse but I think the problem with the attempted fix is that the null check is done at the hasReport level while the failure happens inside SerenityJsonSummaryFile

          Is there any reason not to just wrap each generator in InfluxDbPublicationService in a try catch the way some like the perfPublisher are?

          Kris Conklin added a comment - We aren't using Serenity either so I think this is a not using Serenity problem on Java17. I will admit to mostly being a noob when it comes to plugins and mostly a C guy so Java isn't my wheelhouse but I think the problem with the attempted fix is that the null check is done at the hasReport level while the failure happens inside SerenityJsonSummaryFile Is there any reason not to just wrap each generator in InfluxDbPublicationService in a try catch the way some like the perfPublisher are?

          Kris Conklin added a comment -

          I just wanted to update that I installed version 3.6 and the issue has been resolved for me.

          Kris Conklin added a comment - I just wanted to update that I installed version 3.6 and the issue has been resolved for me.

          Aleksi Simell added a comment -

          Thanks for letting me know. I had already forgotten this ticket existed, but the fix was introduced in a PR that was merged for 3.6. I'll close this issue again.

          Aleksi Simell added a comment - Thanks for letting me know. I had already forgotten this ticket existed, but the fix was introduced in a PR that was merged for 3.6. I'll close this issue again.

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

              Created:
              Updated:
              Resolved: