80% of the time build fails with Error: write EPIPE error

nodejs
docker
2.0

#1

Building a JavaScript application using Create React App (yarn build) fails in ~80% of the time with the following error:

Error: write EPIPE
    at WriteWrap.afterWrite [as oncomplete] (net.js:844:14)
Emitted 'error' event at:
    at onwriteError (_stream_writable.js:431:12)
    at onwrite (_stream_writable.js:453:5)
    at _destroy (internal/streams/destroy.js:39:7)
    at Socket._destroy (net.js:548:3)
    at Socket.destroy (internal/streams/destroy.js:32:8)
    at WriteWrap.afterWrite [as oncomplete] (net.js:846:10)

In other cases the same commit triggers this error:

/home/circleci/project/node_modules/thread-loader/dist/WorkerPool.js:393
              throw _iteratorError2;
              ^

Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:356:12)
    at PoolWorker.writeEnd (/home/circleci/project/node_modules/thread-loader/dist/WorkerPool.js:93:22)
    at PoolWorker.dispose (/home/circleci/project/node_modules/thread-loader/dist/WorkerPool.js:264:12)
    at WorkerPool.disposeWorkers (/home/circleci/project/node_modules/thread-loader/dist/WorkerPool.js:381:20)
    at Timeout._onTimeout (/home/circleci/project/node_modules/thread-loader/dist/WorkerPool.js:365:25)
    at ontimeout (timers.js:466:11)
    at tryOnTimeout (timers.js:304:5)
    at Timer.listOnTimeout (timers.js:267:5)
Emitted 'error' event at:
    at Socket.writeAfterFIN [as write] (net.js:359:8)
    at PoolWorker.writeEnd (/home/circleci/project/node_modules/thread-loader/dist/WorkerPool.js:93:22)
    [... lines matching original stack trace ...]
    at Timer.listOnTimeout (timers.js:267:5)

I’m unable to reproduce the same issue in a local environment.


#2

The link indicates that it is a library issue. Did you try the various solutions contained therein? What sort of further assistance are you seeking?


#3

@halfer I’m not using this library, it just demonstrates that other folks are bumping into the same issue when trying to build a JavaScript app on Circle CI. Also, note that this error behavior is inconsistent, hitting [Rebuild] fails with different errors, finally ending up with a successful build.


#4

Fair enough. I don’t have any particular views on what causes it, except that what CircleCI does inside Docker is pretty minimal, and I’d wager 90% of failed tests are standard Linux issues (e.g. permissions, library bugs, race conditions, etc).

Can readers here see your entire YAML file, in a formatted block? Maybe there’s some clues in there that will prompt thoughts on what to try debugging next.


#5

Here, it fails on the “yarn build” step (compiling a React.js app using Create React App tooling)

Interestingly, when I compile the app with DEBUG=babel flag it seems to build without errors: DEBUG=babel yarn build.


#7

I’m encountering the same issue on my build. I have to build 2 react apps during my build: a smaller simpler one that is working fine and a larger typescript one which throws errors consistently. Adding DEBUG=babel fixes the error but increases build time and useless output. My theory is that this is some kind of resources issue since it works locally and started failing as the app grew in size and complexity. Happy to provide more information but I am kind of stumped about what else to do/try.


#8

I’m having this too (in my case I’m using Vue.js) the 100% times.

#!/bin/bash -eo pipefail
yarn build
yarn run v1.9.2
$ vue-cli-service build

Starting type checking service...
Using 1 worker with 2048MB memory limit
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:401:12)
    at PoolWorker.writeJson (/home/circleci/bloqify/generic/node_modules/thread-loader/dist/WorkerPool.js:89:22)
    at PoolWorker.run (/home/circleci/bloqify/generic/node_modules/thread-loader/dist/WorkerPool.js:69:12)
    at WorkerPool.distributeJob (/home/circleci/bloqify/generic/node_modules/thread-loader/dist/WorkerPool.js:326:20)
    at /home/circleci/bloqify/generic/node_modules/async/queue.js:10:5
    at Object.process (/home/circleci/bloqify/generic/node_modules/async/internal/queue.js:175:17)
    at /home/circleci/bloqify/generic/node_modules/async/internal/queue.js:82:19
    at Immediate.<anonymous> (/home/circleci/bloqify/generic/node_modules/async/internal/setImmediate.js:27:16)
    at runCallback (timers.js:693:18)
    at tryOnImmediate (timers.js:664:5)
    at processImmediate (timers.js:646:5)
Emitted 'error' event at:
    at Socket.writeAfterFIN [as write] (net.js:404:8)
    at PoolWorker.writeJson (/home/circleci/bloqify/generic/node_modules/thread-loader/dist/WorkerPool.js:89:22)
    [... lines matching original stack trace ...]
    at processImmediate (timers.js:646:5)
error Command failed with exit code 1.

If I build with --mode= *development* it works correctly.


#9

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.