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

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 Likes

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?

@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.

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.

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.

2 Likes

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.

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