Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write EPIPE when using ChildProcessWorker.js #10144

Closed
sibelius opened this issue Jun 8, 2020 · 14 comments
Closed

write EPIPE when using ChildProcessWorker.js #10144

sibelius opened this issue Jun 8, 2020 · 14 comments

Comments

@sibelius
Copy link

sibelius commented Jun 8, 2020

🐛 Bug Report

events.js:292
 
      throw er; // Unhandled 'error' event
 
      ^
 

 
Error: write EPIPE
 
    at ChildProcess.target._send (internal/child_process.js:806:20)
 
    at ChildProcess.target.send (internal/child_process.js:677:19)
 
    at ChildProcessWorker.send (/home/circleci/app/node_modules/jest-worker/build/workers/ChildProcessWorker.js:291:17)
 
    at WorkerPool.send (/home/circleci/app/node_modules/jest-worker/build/WorkerPool.js:32:34)
 
    at Farm._process (/home/circleci/app/node_modules/jest-worker/build/Farm.js:129:10)
 
    at Farm._enqueue (/home/circleci/app/node_modules/jest-worker/build/Farm.js:152:10)
 
    at Farm._push (/home/circleci/app/node_modules/jest-worker/build/Farm.js:159:12)
 
    at /home/circleci/app/node_modules/jest-worker/build/Farm.js:90:14
 
    at new Promise (<anonymous>)
 
    at Farm.doWork (/home/circleci/app/node_modules/jest-worker/build/Farm.js:56:12)
 
Emitted 'error' event on ChildProcess instance at:
 
    at internal/child_process.js:810:39
 
    at processTicksAndRejections (internal/process/task_queues.js:79:11) {
 
  errno: 'EPIPE',
 
  code: 'EPIPE',
 
  syscall: 'write'
 
}
 
error Command failed with exit code 1.
 

We run our tests in CircleCI using maxWorker=4

For some tests ChildProcessWorker.send fails and break all the tests execution

To Reproduce

Try to run many tests at the same time

Expected behavior

It should not break

Link to repl or repo (highly encouraged)

our internal repo is similar to this one https://github.com/entria/entria-fullstack/tree/master/packages/server
We use a mongodb memory server to run tests.

envinfo

System:
    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
  Binaries:
    Node: 12.18.0 - ~/.nvm/versions/node/v12.18.0/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v12.18.0/bin/npm
  npmPackages:
    jest: 26.0.1 => 26.0.1 

it can be related to #8507
not sure if this is node version specific

@tabrindle
Copy link
Contributor

tabrindle commented Jun 18, 2020

Also encountering this after upgrading from node 10 to 12, and upgrading from jest 23 to 26.

  System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
  Binaries:
    Node: 12.16.3 - ~/.nvm/versions/node/v12.16.3/bin/node
    Yarn: 1.22.4 - ~/.nvm/versions/node/v12.16.3/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v12.16.3/bin/npm
  npmPackages:
    jest: 26.0.1 => 26.0.1 

@JanithaR
Copy link

JanithaR commented Jun 26, 2020

This has been happening to me as well randomly but as of today, it is constant. Probable cause is adding more tests. No Node or Jest updates occurred.

@alexya
Copy link

alexya commented Jul 31, 2020

I met a similar issue like this when I ran jest --coverage

Updated:
I have 64G memory, even if there is some memory leak, it should not crash the Jest itself. And it is very hard for us to "find" the location where memory leaks when our project is very big. It will be much helpful if the Jest could help us to wrap the issue, ignore the crash case or mark the case with failure, and run the left.

os: win10 LTSC 2019 (updated to latest)
node: 10.19.0
jest: 26.0.1 ( and tried 25.5.4)
yarn: 1.22.4

Test Suites: 1 skipped, 165 passed, 165 of 476 total
Tests:       67 skipped, 3372 passed, 3439 total
Snapshots:   31 passed, 31 total
Time:        223sevents.js:174
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at ChildProcess.target._send (internal/child_process.js:762:20)
    at ChildProcess.target.send (internal/child_process.js:634:19)
    at ChildProcessWorker.send (C:\src\web-2nd\node_modules\jest-worker\build\workers\ChildProcessWorker.js:291:17)
    at WorkerPool.send (C:\src\web-2nd\node_modules\jest-worker\build\WorkerPool.js:32:34)
    at Farm._process (C:\src\web-2nd\node_modules\jest-worker\build\Farm.js:129:10)
    at Farm._enqueue (C:\src\web-2nd\node_modules\jest-worker\build\Farm.js:152:10)
    at Farm._push (C:\src\web-2nd\node_modules\jest-worker\build\Farm.js:159:12)
    at Promise (C:\src\web-2nd\node_modules\jest-worker\build\Farm.js:90:14)
    at new Promise (<anonymous>)
    at Farm.doWork (C:\src\web-2nd\node_modules\jest-worker\build\Farm.js:56:12)
Emitted 'error' event at:
    at process.nextTick (internal/child_process.js:766:39)
    at process._tickCallback (internal/process/next_tick.js:61:11)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@antho686
Copy link

antho686 commented Sep 11, 2020

I met a similar issue also when running jest --coverage, it happens randomly
os: win10 version 1909
node: 12.18.0
jest: 26.0.1
npm: 6.14.4
`
Snapshot Summary
ÔÇ║ 1 snapshot failed from 1 test suite. Inspect your code changes or re-run jest with -u to update them.

Test Suites: 1 failed, 16 passed, 17 total
Tests: 1 failed, 71 passed, 72 total
Snapshots: 1 failed, 9 passed, 10 total
Time: 23.033 s
Ran all test suites.

events.js:292
throw er; // Unhandled 'error' event
^

Error: write EPIPE
at ChildProcess.target._send (internal/child_process.js:806:20)
at ChildProcess.target.send (internal/child_process.js:677:19)
at ChildProcess. (C:\Users\ddn4292\Projets\MQ\WEBAPP\webcomponents-detention\node_modules@stencil\core\dev-server\index.js:183:13)
at ChildProcess.emit (events.js:315:20)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:85:21)
Emitted 'error' event on ChildProcess instance at:
at internal/child_process.js:810:39
at processTicksAndRejections (internal/process/task_queues.js:79:11) {
errno: 'EPIPE',
code: 'EPIPE',
syscall: 'write'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webcomponents-detention@0.0.1 test: stencil test --spec --e2e --coverage
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webcomponents-detention@0.0.1 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ddn4292\AppData\Roaming\npm-cache_logs\2020-09-11T19_23_58_027Z-debug.log
`

@indieocean
Copy link

I deleted the coverage folder and re-ran it and the error went away.

@classic0
Copy link

classic0 commented Oct 1, 2020

Unexpected, the same without --verbose flag.

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'test' ]
2 info using npm@6.13.7
3 info using node@v13.9.0
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle src@1.0.0~pretest: src@1.0.0
6 info lifecycle src@1.0.0~test: src@1.0.0
7 verbose lifecycle src@1.0.0~test: unsafe-perm in lifecycle true
10 silly lifecycle src@1.0.0~test: Args: [ '-c', 'jest --verbose ./src/core' ]
11 silly lifecycle src@1.0.0~test: Returned: code: 1  signal: null
12 info lifecycle src@1.0.0~test: Failed to exec test script
13 verbose stack Error: src@1.0.0 test: `jest --verbose ./src/core`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:321:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:321:20)
13 verbose stack     at maybeClose (internal/child_process.js:1026:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid src@1.0.0
15 verbose cwd /home/userFolder/Kribamine/core
16 verbose **Linux 4.9.0-13-amd64**
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test"
18 verbose **node v13.9.0**
19 verbose npm  v6.13.7
20 error code ELIFECYCLE
21 error errno 1
22 error src@1.0.0 test: `jest --verbose ./src/core`
22 error Exit status 1
23 error Failed at the src@1.0.0 test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

@edward-smith
Copy link

edward-smith commented Oct 2, 2020

We're getting this error on a 3G VM but it builds successfully on a 7G VM:

 18:14:29.2938 > set NODE_OPTIONS=--max-old-space-size=2048 && react-scripts build
 18:14:29.2938 
 18:14:30.3562 Creating an optimized production build...
 18:17:19.5046 events.js:291
 18:17:19.5060       throw er; // Unhandled 'error' event
 18:17:19.5060       ^
 18:17:19.5060 
 18:17:19.5060 Error: write EPIPE
 18:17:19.5060     at ChildProcess.target._send (internal/child_process.js:831:20)
 18:17:19.5060     at ChildProcess.target.send (internal/child_process.js:702:19)
 18:17:19.5060     at ChildProcessWorker.send (/inventory-ui/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/workers/ChildProcessWorker.js:291:17)
 18:17:19.5060     at WorkerPool.send (/inventory-ui/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/WorkerPool.js:32:34)
 18:17:19.5060     at Farm._process (/inventory-ui/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/Farm.js:129:10)
 18:17:19.5060     at Farm._enqueue (/inventory-ui/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/Farm.js:152:10)
 18:17:19.5060     at Farm._push (/inventory-ui/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/Farm.js:159:12)
 18:17:19.5060     at /inventory-ui/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/Farm.js:90:14
 18:17:19.5060     at new Promise (<anonymous>)
 18:17:19.5060     at Farm.doWork (/inventory-ui/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/Farm.js:56:12)
 18:17:19.5060     at JestWorker._callFunctionWithArgs (/inventory-ui/node_modules/terser-webpack-plugin/node_modules/jest-worker/build/index.js:143:23)
 18:17:19.5060     at TaskRunner.runTask (/inventory-ui/node_modules/terser-webpack-plugin/dist/TaskRunner.js:41:26)
 18:17:19.5061     at enqueue (/inventory-ui/node_modules/terser-webpack-plugin/dist/TaskRunner.js:89:35)
 18:17:19.5061     at /inventory-ui/node_modules/terser-webpack-plugin/dist/TaskRunner.js:113:86
 18:17:19.5061 Emitted 'error' event on ChildProcess instance at:
 18:17:19.5061     at internal/child_process.js:835:39
 18:17:19.5061     at processTicksAndRejections (internal/process/task_queues.js:75:11) {
 18:17:19.5061   errno: -32,
 18:17:19.5061   code: 'EPIPE',
 18:17:19.5061   syscall: 'write'
 18:17:19.5061 }

@sibelius
Copy link
Author

sibelius commented Oct 2, 2020

this happens when your tests have memory leak

@sibelius sibelius closed this as completed Oct 2, 2020
@rohan-pereira-agl
Copy link

rohan-pereira-agl commented Oct 26, 2020

One of the main cause of this error is when your code throws an error and the error isn't caught.

Look for places in the code that call 'Throw new Error()' or promise.reject() or promise failures from incorrectly stubbed unit tests. Try to handle these errors in catch block somewhere higher up instead of bubbling up uncaught.

@lemzoo
Copy link

lemzoo commented Jan 28, 2021

I think the issue is related to memory leak. After closing a bulk of windows and program, the error disapear.

@malthoff
Copy link

Too little memory was the problem for me. My context was nest.js running in docker and I set the memory at a limit of 128mb, which was reached very fast :)

@ramakrishnan7675
Copy link

I had same issue. I have Disabled the Memory Protection in my BIOS settings and the error gone.

@hoepfnerdennis
Copy link

reducing workers fixed it for me too. eg jest --maxWorkers 2

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests