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

FileLogStorage maybeFlush error with logstash and parallel stages pipeline

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • logstash-plugin, pipeline
    • None
    • Jenkins: 2.164.3

      My pipeline for test:

      pipeline {
          agent { label 'master' }
          stages {
              stage('Stage in parallel') {
                  parallel {
                      stage('My stage 1') {
                          steps {
                              logstash {
                                  sh '''#!/bin/bash
                                  for i in {1..10000}
                                  do
                                     echo "#1 Welcome $i times"
                                  done
                                  '''
                              }
                          }
                      }
                      stage('My stage 2') {
                          steps {
                              logstash {
                                  sh '''#!/bin/bash
                                  for i in {1..10000}
                                  do
                                     echo "#2 Welcome $i times"
                                  done
                                  '''
                              }
                          }
                      }
                  }
              }
          }
      }
      

      If I go into the log console then I have a lot of messages of errors in jenkins logs:

      mai 19, 2020 4:54:09 PM org.jenkinsci.plugins.workflow.log.FileLogStorage maybeFlushmai 19, 2020 4:54:09 PM org.jenkinsci.plugins.workflow.log.FileLogStorage maybeFlushAVERTISSEMENT: failed to flush /tmp/logstash-plugin/work/jobs/afac/builds/5/logjava.io.IOException: Stream Closed at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(FileOutputStream.java:326) at org.jenkinsci.plugins.workflow.log.DelayBufferedOutputStream$FlushControlledOutputStream.write(DelayBufferedOutputStream.java:129) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) at java.io.FilterOutputStream.flush(FilterOutputStream.java:140) at org.jenkinsci.plugins.workflow.log.FileLogStorage.maybeFlush(FileLogStorage.java:190) at org.jenkinsci.plugins.workflow.log.FileLogStorage.overallLog(FileLogStorage.java:198) at org.jenkinsci.plugins.workflow.job.WorkflowRun.getLogText(WorkflowRun.java:1034) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408) at org.kohsuke.stapler.MetaClass$2.doDispatch(MetaClass.java:221) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:739) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:870) at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:458) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:739) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:870) at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:282) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:739) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:870) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:668) at org.kohsuke.stapler.Stapler.service(Stapler.java:238) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:755) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154) at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:248) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:61) 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:1604) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:64) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) 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:1604) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:566) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1607) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1297) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1577) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1212) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.Server.handle(Server.java:500) at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) 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:336) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:388) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) at java.lang.Thread.run(Thread.java:748)
      

      Note that the console of log is then blocked.
      If I go out of the log console, then I have the following messages of error in jenkins:

      mai 19, 2020 4:54:15 PM org.jenkinsci.plugins.workflow.support.concurrent.Timeout lambda$ping$0
      INFOS: org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep [#2]: checking /tmp/logstash-plugin/work/workspace/afac on  unresponsive for 15 s
      mai 19, 2020 4:54:15 PM org.jenkinsci.plugins.workflow.support.concurrent.Timeout lambda$ping$0
      INFOS: org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep [#1]: checking /tmp/logstash-plugin/work/workspace/afac on  unresponsive for 15 s
      
      

      This issue might be related to https://issues.jenkins-ci.org/browse/JENKINS-56446
      But it is reproducible within the plugin logstash.
      In fact this issue blocks the usage of the plugin logstash in my case.

       

          [JENKINS-62354] FileLogStorage maybeFlush error with logstash and parallel stages pipeline

          Thanks for the report.
          This looks like a duplicate of JENKINS-56446 as I don't see the logstash plugin anywhere in the stack trace.
          I'm afraid there's not much I can do to help if that's the case.

          Have you tried running this without Blueocean installed? Not sure if it's related but that would remove one component from the equation.
          Personally I find Jenkinsfiles more trouble than it's worth (this would be one of many examples), I try to stick to old style jobs.

          Jakub Bochenski added a comment - Thanks for the report. This looks like a duplicate of JENKINS-56446 as I don't see the logstash plugin anywhere in the stack trace. I'm afraid there's not much I can do to help if that's the case. Have you tried running this without Blueocean installed? Not sure if it's related but that would remove one component from the equation. Personally I find Jenkinsfiles more trouble than it's worth (this would be one of many examples), I try to stick to old style jobs.

          Devin Nusbaum added a comment -

          Closing as a duplicate of JENKINS-56446.

          Devin Nusbaum added a comment - Closing as a duplicate of JENKINS-56446 .

            jbochenski Jakub Bochenski
            tgatinea Thierry GATINEAU
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: