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

NPE when saving Jenkins configuration if audit console logger is added in JCASC

    XMLWordPrintable

Details

    Description

      Audit Trail plugin 3.0 is installed in Jenkins 2.190.3.

      Audit console logger is added in JCASC block:

       

      audit-trail:
        logBuildCause: true
        loggers:
        - console:
            dateFormat: "yyyy-MM-dd HH:mm:ss:SSS"
            logPrefix: "audit"
            output: STD_OUT
        pattern: ".*/(?:configSubmit|doDelete|postBuildResult|enable|disable|cancelQueue|stop|toggleLogKeep|doWipeOutWorkspace|createItem|createView|toggleOffline|cancelQuietDown|quietDown|restart|exit|safeExit)"
      

      The following exception is thrown when clicking on save or apply button:

       

      java.lang.NullPointerException
      	at hudson.plugins.audit_trail.ConsoleAuditLogger.log(ConsoleAuditLogger.java:49)
      	at hudson.plugins.audit_trail.AuditTrailFilter.onRequest(AuditTrailFilter.java:129)
      	at hudson.plugins.audit_trail.AuditTrailFilter.doFilter(AuditTrailFilter.java:105)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
      	at jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:128)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
      	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:99)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      	at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
      	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
      	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.Server.handle(Server.java:505)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
      	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
      	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)
      	at java.lang.Thread.run(Thread.java:748)
      

      There is no exception if audit logger is added without JCASC.

       

       

      Attachments

        Issue Links

          Activity

            pierrebtz Pierre Beitz added a comment -

            asmirnov I reproduced the issue and started working on a fix. Issue is bigger than you though as currently the plugin won't perform correctly if configured with JCASC only (no remaining audit-trail xml on disk, and that even if the UI in the global config looks ok).

            I have a working fix, but I want to double check all the use cases and writing non regression tests... I hope to commit something within the week.

            pierrebtz Pierre Beitz added a comment - asmirnov I reproduced the issue and started working on a fix. Issue is bigger than you though as currently the plugin won't perform correctly if configured with JCASC only (no remaining audit-trail xml on disk, and that even if the UI in the global config looks ok). I have a working fix, but I want to double check all the use cases and writing non regression tests... I hope to commit something within the week.
            pierrebtz Pierre Beitz added a comment -

            asmirnov I just created a PR that fixes this issue. I plan on merging it tomorrow if nobody comes up with a comment...

            In case you wish to test this version, here is the build from the CI: https://ci.jenkins.io/job/Plugins/job/audit-trail-plugin/job/PR-29/1/artifact/target/audit-trail.hpi

             

            pierrebtz Pierre Beitz added a comment - asmirnov I just created a PR that fixes this issue. I plan on merging it tomorrow if nobody comes up with a comment... In case you wish to test this version, here is the build from the CI:  https://ci.jenkins.io/job/Plugins/job/audit-trail-plugin/job/PR-29/1/artifact/target/audit-trail.hpi  
            asmirnov Alexander Smirnov added a comment - - edited

            Thank you pierrebtz. I tested PR 29 version and confirm that it works: no exceptions when saving Jenkins configuration, audit logs are printed in stdout.

            asmirnov Alexander Smirnov added a comment - - edited Thank you  pierrebtz . I tested PR 29 version and confirm that it works: no exceptions when saving Jenkins configuration, audit logs are printed in stdout.
            pierrebtz Pierre Beitz added a comment -

            asmirnov thanks for the feedback! I just released version 3.2 of the plugin with this fix, it should be available in the next hours, time for the update centers to refresh

            pierrebtz Pierre Beitz added a comment - asmirnov thanks for the feedback! I just released version 3.2 of the plugin with this fix, it should be available in the next hours, time for the update centers to refresh

            People

              pierrebtz Pierre Beitz
              asmirnov Alexander Smirnov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: