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

LogFileFilter plugin with JCasC throws NPE

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      After starting a Jenkins instance with a simple configuration, Jenkins throws NPE when trying to filter lines.  Of note, I'm using the plugin from a Jenkins Shared library within in a declarative pipeline. 

      There is a very simple workaround under "Configure System"

      1.  Un-check the "Enable Gobally" box under the plugin configuration

      2.  Click Apply 

      3.  Re-check "Enable Globally"

      4.  Click Apply

      After this, no more NPE's are thrown.

       

      JCasC Config

      unclassified:
        globalLibraries:
          libraries:
            - name: "demo_jenkins_library"
              defaultVersion: "master"
              retriever:
                modernSCM:
                  scm:
                    git:
                      remote: "http://gitbucket/git/root/demo_jenkins_library.git"
                      credentialsId: "DEMO_GIT_CREDS"
                      
        logFileFilterConfig:
          enabledDefaultRegexp: false
          enabledGlobally: true
          regexpPairs:
          - regexp: "docker inspect.*\n"
          - regexp: "commandRunner:.*\n"
          - regexp: "docker exec.*\n"
      

       

       

      Error

      2020-05-17 16:27:03.085+0000 [id=548] WARNING c.t.s.LogFileFilterOutputStream#filterLine: Exception when wrapping log output for LogFileFilterLogger in line '+ docker inspect -f {{ .Os }} conanio/gcc8
      ' got: 'java.lang.NullPointerException'.
      

      Full Stacktrace

      jenkins | 2020-05-17 16:27:03.085+0000 [id=548] WARNING c.t.s.LogFileFilterOutputStream#filterLine: Exception when wrapping log output for LogFileFilterLogger in line '+ docker inspect -f {{ .Os }} conanio/gcc8
      jenkins | ' got: 'java.lang.NullPointerException'.
      jenkins | java.lang.NullPointerException
      jenkins | at java.util.regex.Matcher.appendReplacement(Matcher.java:804)
      jenkins | at java.util.regex.Matcher.replaceAll(Matcher.java:955)
      jenkins | at com.tsystems.sbs.LogFileFilterOutputStream.filterLine(LogFileFilterOutputStream.java:120)
      jenkins | at com.tsystems.sbs.LogFileFilterOutputStream.eol(LogFileFilterOutputStream.java:91)
      jenkins | at hudson.console.LineTransformationOutputStream.eol(LineTransformationOutputStream.java:60)
      jenkins | at hudson.console.LineTransformationOutputStream.write(LineTransformationOutputStream.java:56)
      jenkins | at java.io.PrintStream.write(PrintStream.java:449)
      jenkins | at java.io.FilterOutputStream.write(FilterOutputStream.java:77)
      jenkins | at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution$NewlineSafeTaskListener$1.write(DurableTaskStep.java:451)
      jenkins | at java.io.FilterOutputStream.write(FilterOutputStream.java:125)
      jenkins | at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution$NewlineSafeTaskListener$1.write(DurableTaskStep.java:455)
      jenkins | at java.io.PrintStream.write(PrintStream.java:480)
      jenkins | at java.io.FilterOutputStream.write(FilterOutputStream.java:97)
      jenkins | at org.apache.commons.io.output.ProxyOutputStream.write(ProxyOutputStream.java:71)
      jenkins | at hudson.remoting.RemoteOutputStream.write(RemoteOutputStream.java:104)
      jenkins | at org.jenkinsci.plugins.durabletask.FileMonitoringTask$FileMonitoringController$WriteLog.invoke(FileMonitoringTask.java:256)
      jenkins | at org.jenkinsci.plugins.durabletask.FileMonitoringTask$FileMonitoringController$WriteLog.invoke(FileMonitoringTask.java:238)
      jenkins | at hudson.FilePath.act(FilePath.java:1075)
      jenkins | at hudson.FilePath.act(FilePath.java:1058)
      jenkins | at org.jenkinsci.plugins.durabletask.FileMonitoringTask$FileMonitoringController.writeLog(FileMonitoringTask.java:227)
      jenkins | at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.check(DurableTaskStep.java:591)
      jenkins | at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.run(DurableTaskStep.java:548)
      jenkins | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      jenkins | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      jenkins | at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
      jenkins | at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      jenkins | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      jenkins | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      jenkins | at java.lang.Thread.run(Thread.java:748)
      

        Attachments

          Activity

          Hide
          solvingj jerry wiltse added a comment -

          User error.

          Two different configs for logfileFilter plugin were found in the jenkins.yaml, separated by many lines. One of them had invalid content. 

          Show
          solvingj jerry wiltse added a comment - User error. Two different configs for logfileFilter plugin were found in the jenkins.yaml, separated by many lines. One of them had invalid content. 

            People

            Assignee:
            carlescapdevila Carles Capdevila
            Reporter:
            solvingj jerry wiltse
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: