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

Websocket connections crash if message size is greater than 64Kb

XMLWordPrintable

    • Jenkins 2.229

      Websocket connections fail if the response from a pipeline step is greater than 64kb. 

      Steps to recreate the problem:

      1. Run a jenkins server using the docker container jenkins/jenkins:centos
      2. Create a New Node with webSocket enabled
      3. On another Linux VM/slave machine, run the agent.jar with -webSocket option to connect to the Jenkins Master
      4. Create a pipeline with a step that would output text >64kb. For example, create a text file with size > 64Kb. 'cat' the file as a pipeline step. 
      pipeline {
        agent {
          label 'test-channelclose'
        }  
        stages {
          stage ('Debug Issue') {
            steps {
              sh 'cat build_output.log'
              //archiveArtifacts 'build_output.log'
            }
          }
        }
      }
      

      5. Running the pipeline will break with the following error.

      Mar 07, 2020 2:31:28 PM jenkins.agents.WebSocketAgents$Session error
      WARNING: null
      org.eclipse.jetty.websocket.api.MessageTooLargeException: Binary message size [524494] exceeds maximum size [65536]
              at org.eclipse.jetty.websocket.api.WebSocketPolicy.assertValidBinaryMessageSize(WebSocketPolicy.java:128)
              at org.eclipse.jetty.websocket.common.Parser.assertSanePayloadLength(Parser.java:133)
              at org.eclipse.jetty.websocket.common.Parser.parseFrame(Parser.java:494)
              at org.eclipse.jetty.websocket.common.Parser.parseSingleFrame(Parser.java:253)
              at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:460)
              at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:441)
              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: One of the workaround is to write the output to a file and archive the file. However, not all pipeline steps support an easy way to write the output to file.

            vlatombe Vincent Latombe
            kjayaraman Karthik Jayaraman
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: