Wojtas.Zet
Wojtas.Zet

Reputation: 816

jenkins pipeline - java.io.EOFException

I have quite simple Jenkins pipeline code:

            stage('Install') {
                steps {
                    script {
                        dir("${PROJECT}") {
                            try {
                                script {
                                    sh('npm install')
                                    }
                            } catch (Exception e) {
                                throw e
                            }
                        }
                    }
                }
            }

And each time I run it I am seeing following error in Jenkins console output:

12:48:07  + npm install
12:49:00  java.io.EOFException
12:49:00    at okio.RealBufferedSource.require(RealBufferedSource.java:61)
12:49:00    at okio.RealBufferedSource.readByte(RealBufferedSource.java:74)
12:49:00    at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.java:117)
12:49:00    at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:101)
12:49:00    at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.java:274)
12:49:00    at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:214)
12:49:00    at okhttp3.RealCall$AsyncCall.execute(RealCall.java:203)
12:49:00    at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
12:49:00    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
12:49:00    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
12:49:00    at java.lang.Thread.run(Thread.java:748)

I am running

Jenkins 2.235.5

Do you have any ideas what is wrong with my code? There is roughly 60 seconds between npm install and this exception, could it be some timeout?

Upvotes: 1

Views: 1283

Answers (1)

I have faced this issue too. And in my case most of the time I observed it happened due to

  1. lack of memory/cpu cores for build. I spent some time testing it, and resolved this issue on our site by increasing java heap size
  2. Lack of cores. increasing number of cores definately helps!
  3. and also do some tuning like checking open file descriptors etc

Upvotes: 1

Related Questions