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

Sending console logs when using Jenkins agents results in: java.lang.IllegalStateException: Jenkins.instance is missing

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      1.9.4

      Description

      We are seeing the following error appear with the newest version of the Splunk plugin (1.9.3) when attempting to run builds. This error ONLY appears if we are sending console logs either through use of sendSplunkConsoleLogs() or by checking the box to do so in the UI for the plugin. It appears it is trying to access jenkins.Instance from the agent, which of course is only possible from the master. We also noticed this mention in the comments of another issue, but it appears to be unrelated to the overall other issue: https://issues.jenkins-ci.org/browse/JENKINS-61452?focusedCommentId=392193&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-392193

      SEVERE: flush log error
      java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong.
      	at jenkins.model.Jenkins.get(Jenkins.java:779)
      	at jenkins.model.Jenkins.getActiveInstance(Jenkins.java:791)
      	at com.splunk.splunkjenkins.SplunkJenkinsInstallation.get(SplunkJenkinsInstallation.java:106)
      	at com.splunk.splunkjenkins.utils.SplunkLogService.sendBatch(SplunkLogService.java:162)
      	at com.splunk.splunkjenkins.console.SplunkTaskListenerFactory.flushLog(SplunkTaskListenerFactory.java:85)
      	at com.splunk.splunkjenkins.console.SplunkTaskListenerFactory.enqueue(SplunkTaskListenerFactory.java:74)
      	at com.splunk.splunkjenkins.console.LabelConsoleLineStream.eol(LabelConsoleLineStream.java:52)
      	at com.splunk.splunkjenkins.console.LabelConsoleLineStream.write(LabelConsoleLineStream.java:34)
      	at java.io.FilterOutputStream.write(FilterOutputStream.java:125)
      	at java.io.PrintStream.write(PrintStream.java:480)
      	at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
      	at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
      	at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104)
      	at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185)
      	at java.io.PrintStream.newLine(PrintStream.java:546)
      	at java.io.PrintStream.println(PrintStream.java:807)
      	at com.checkmarx.jenkins.CxLoggerAdapter.info(CxLoggerAdapter.java:59)
      	at com.cx.restclient.sast.utils.zip.CxZip$1.updateProgress(CxZip.java:33)
      	at com.cx.restclient.sast.utils.zip.Zipper.zipFile(Zipper.java:67)
      	at com.cx.restclient.sast.utils.zip.Zipper.zip(Zipper.java:41)
      	at com.cx.restclient.sast.utils.zip.CxZip.zipWorkspaceFolder(CxZip.java:41)
      	at com.cx.restclient.sast.utils.zip.CxZipUtils.zipWorkspaceFolder(CxZipUtils.java:30)
      	at com.cx.restclient.CxSASTClient.createSASTScan(CxSASTClient.java:106)
      	at com.cx.restclient.CxShragaClient.createSASTScan(CxShragaClient.java:82)
      	at com.checkmarx.jenkins.CxScanCallable.invoke(CxScanCallable.java:90)
      	at com.checkmarx.jenkins.CxScanCallable.invoke(CxScanCallable.java:21)
      	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3069)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      	at hudson.remoting.Request$2.run(Request.java:369)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:117)
      	at java.lang.Thread.run(Thread.java:748)
      

      EDIT: We are noticing this issue has only consistently appeared on our maven agent (upstream here: https://catalog.redhat.com/software/containers/openshift3/jenkins-agent-maven-35-rhel7/5ad9139ebed8bd441305ce98)

        Attachments

          Issue Links

            Activity

            jhoenzsch Josef Hoenzsch created issue -
            jhoenzsch Josef Hoenzsch made changes -
            Field Original Value New Value
            Description We are seeing the following error appear with the newest version of the Splunk plugin (1.9.3) when attempting to run builds. This error ONLY appears if we are sending console logs either through use of sendSplunkConsoleLogs() or by checking the box to do so in the UI for the plugin. It appears it is trying to access jenkins.Instance from the agent, which of course is only possible from the master. We also noticed this mention in the comments of another issue, but it appears to be unrelated to the overall other issue: https://issues.jenkins-ci.org/browse/JENKINS-61452?focusedCommentId=392193&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-392193
            {code:java}
            SEVERE: flush log error
            java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong.
            at jenkins.model.Jenkins.get(Jenkins.java:779)
            at jenkins.model.Jenkins.getActiveInstance(Jenkins.java:791)
            at com.splunk.splunkjenkins.SplunkJenkinsInstallation.get(SplunkJenkinsInstallation.java:106)
            at com.splunk.splunkjenkins.utils.SplunkLogService.sendBatch(SplunkLogService.java:162)
            at com.splunk.splunkjenkins.console.SplunkTaskListenerFactory.flushLog(SplunkTaskListenerFactory.java:85)
            at com.splunk.splunkjenkins.console.SplunkTaskListenerFactory.enqueue(SplunkTaskListenerFactory.java:74)
            at com.splunk.splunkjenkins.console.LabelConsoleLineStream.eol(LabelConsoleLineStream.java:52)
            at com.splunk.splunkjenkins.console.LabelConsoleLineStream.write(LabelConsoleLineStream.java:34)
            at java.io.FilterOutputStream.write(FilterOutputStream.java:125)
            at java.io.PrintStream.write(PrintStream.java:480)
            at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
            at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
            at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104)
            at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185)
            at java.io.PrintStream.newLine(PrintStream.java:546)
            at java.io.PrintStream.println(PrintStream.java:807)
            at com.checkmarx.jenkins.CxLoggerAdapter.info(CxLoggerAdapter.java:59)
            at com.cx.restclient.sast.utils.zip.CxZip$1.updateProgress(CxZip.java:33)
            at com.cx.restclient.sast.utils.zip.Zipper.zipFile(Zipper.java:67)
            at com.cx.restclient.sast.utils.zip.Zipper.zip(Zipper.java:41)
            at com.cx.restclient.sast.utils.zip.CxZip.zipWorkspaceFolder(CxZip.java:41)
            at com.cx.restclient.sast.utils.zip.CxZipUtils.zipWorkspaceFolder(CxZipUtils.java:30)
            at com.cx.restclient.CxSASTClient.createSASTScan(CxSASTClient.java:106)
            at com.cx.restclient.CxShragaClient.createSASTScan(CxShragaClient.java:82)
            at com.checkmarx.jenkins.CxScanCallable.invoke(CxScanCallable.java:90)
            at com.checkmarx.jenkins.CxScanCallable.invoke(CxScanCallable.java:21)
            at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3069)
            at hudson.remoting.UserRequest.perform(UserRequest.java:211)
            at hudson.remoting.UserRequest.perform(UserRequest.java:54)
            at hudson.remoting.Request$2.run(Request.java:369)
            at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:117)
            at java.lang.Thread.run(Thread.java:748)
            {code}
            We are seeing the following error appear with the newest version of the Splunk plugin (1.9.3) when attempting to run builds. This error ONLY appears if we are sending console logs either through use of sendSplunkConsoleLogs() or by checking the box to do so in the UI for the plugin. It appears it is trying to access jenkins.Instance from the agent, which of course is only possible from the master. We also noticed this mention in the comments of another issue, but it appears to be unrelated to the overall other issue: https://issues.jenkins-ci.org/browse/JENKINS-61452?focusedCommentId=392193&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-392193
            {code:java}
            SEVERE: flush log error
            java.lang.IllegalStateException: Jenkins.instance is missing. Read the documentation of Jenkins.getInstanceOrNull to see what you are doing wrong.
            at jenkins.model.Jenkins.get(Jenkins.java:779)
            at jenkins.model.Jenkins.getActiveInstance(Jenkins.java:791)
            at com.splunk.splunkjenkins.SplunkJenkinsInstallation.get(SplunkJenkinsInstallation.java:106)
            at com.splunk.splunkjenkins.utils.SplunkLogService.sendBatch(SplunkLogService.java:162)
            at com.splunk.splunkjenkins.console.SplunkTaskListenerFactory.flushLog(SplunkTaskListenerFactory.java:85)
            at com.splunk.splunkjenkins.console.SplunkTaskListenerFactory.enqueue(SplunkTaskListenerFactory.java:74)
            at com.splunk.splunkjenkins.console.LabelConsoleLineStream.eol(LabelConsoleLineStream.java:52)
            at com.splunk.splunkjenkins.console.LabelConsoleLineStream.write(LabelConsoleLineStream.java:34)
            at java.io.FilterOutputStream.write(FilterOutputStream.java:125)
            at java.io.PrintStream.write(PrintStream.java:480)
            at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
            at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
            at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104)
            at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185)
            at java.io.PrintStream.newLine(PrintStream.java:546)
            at java.io.PrintStream.println(PrintStream.java:807)
            at com.checkmarx.jenkins.CxLoggerAdapter.info(CxLoggerAdapter.java:59)
            at com.cx.restclient.sast.utils.zip.CxZip$1.updateProgress(CxZip.java:33)
            at com.cx.restclient.sast.utils.zip.Zipper.zipFile(Zipper.java:67)
            at com.cx.restclient.sast.utils.zip.Zipper.zip(Zipper.java:41)
            at com.cx.restclient.sast.utils.zip.CxZip.zipWorkspaceFolder(CxZip.java:41)
            at com.cx.restclient.sast.utils.zip.CxZipUtils.zipWorkspaceFolder(CxZipUtils.java:30)
            at com.cx.restclient.CxSASTClient.createSASTScan(CxSASTClient.java:106)
            at com.cx.restclient.CxShragaClient.createSASTScan(CxShragaClient.java:82)
            at com.checkmarx.jenkins.CxScanCallable.invoke(CxScanCallable.java:90)
            at com.checkmarx.jenkins.CxScanCallable.invoke(CxScanCallable.java:21)
            at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3069)
            at hudson.remoting.UserRequest.perform(UserRequest.java:211)
            at hudson.remoting.UserRequest.perform(UserRequest.java:54)
            at hudson.remoting.Request$2.run(Request.java:369)
            at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
            at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:117)
            at java.lang.Thread.run(Thread.java:748)
            {code}
            EDIT: We are noticing this issue has only consistently appeared on our maven agent (upstream here: [https://catalog.redhat.com/software/containers/openshift3/jenkins-agent-maven-35-rhel7/5ad9139ebed8bd441305ce98])
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-61452 [ JENKINS-61452 ]
            fengxx Ted Xiao made changes -
            Released As 1.9.4
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Fixed but Unreleased [ 10203 ]
            fengxx Ted Xiao made changes -
            Status Fixed but Unreleased [ 10203 ] Resolved [ 5 ]

              People

              Assignee:
              fengxx Ted Xiao
              Reporter:
              jhoenzsch Josef Hoenzsch
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: