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.