Jest: Jest failing with "Call retries were exceeded", using --runInBand works-around issue

Created on 31 Jul 2019  ·  27Comments  ·  Source: facebook/jest

🐛 Bug Report

I've got 2 test files. In the test, a WebAssembly object gets instantiated. This instantiation seems to stall for some reason when running the test in CI. Locally running jest passes the tests fine.

In CI they fail with this error:

  ● Test suite failed to run

    Call retries were exceeded

      at ChildProcessWorker.initialize (../node_modules/jest-worker/build/workers/ChildProcessWorker.js:193:21)

When -i is used however, they pass as well in CI.

Jest: 24.8.0
Node: 10.15.0
Local env: macOS, 10.14.6 (18G84))
CI env: CircleCI, Docker Linux 6a7bd3b63625 4.15.0-1035-aws #37-Ubuntu SMP Mon Mar 18 16:15:14 UTC 2019 x86_64 GNU/Linux

To Reproduce

I don't have a concise repro repo at this moment.

Expected behavior

I expect the tests to pass as well when not run in band.

Link to repl or repo (highly encouraged)

Don't have it at this moment.

Run npx envinfo --preset jest

Paste the results here:

CI:

npx: installed 1 in 1.719s

  System:
    OS: Linux 4.15 Debian GNU/Linux 9 (stretch) 9 (stretch)
    CPU: (36) x64 Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz
  Binaries:
    Node: 10.15.0 - ~/.nodenv/versions/10.15.0/bin/node
    Yarn: 1.17.3 - /usr/bin/yarn
    npm: 6.4.1 - ~/.nodenv/versions/10.15.0/bin/npm

Local:

Environment:
  OS:  macOS 10.14.6
  Node:  10.15.0
  Yarn:  1.17.3
  npm:  6.4.1
  Watchman:  Not Found
  Xcode:  Xcode 10.3 Build version 10G8
  Android Studio:  3.1 AI-173.4819257
Bug Report Needs Repro Needs Triage

Most helpful comment

I observed that the issue occurs with node v13.2.0, but not with v13.1.0. Looks like the issue with only the latest node version.

All 27 comments

do you use jest-worker? Please provide more information about your use of it if available. or say more about the file that runs your test.

do you use jest-worker?

Not that I’m aware of? I do see it as a dependency in my yarn.lock file.
But I didn’t add any configuration in the jest.config.js for it.

I will try to create a minimal repro example when I find some time.

Ok, do you provide a reproduce code?

I will try to create a minimal repro example when I find some time.

Any lucky on this? I am having the same issue after upgrading to node v13.

I observed that the issue occurs with node v13.2.0, but not with v13.1.0. Looks like the issue with only the latest node version.

@antony2025 same here. After upgrading to node v13.2.0 my test suite which has many async test statements started to fail. Funny thing is that if I delete a few async tests from the test suite it works again.

Same for me I have the same issue w/ Node 10.17.0

I just faced the same issue in CI and was able to reproduce it in local by switching to the latest version of node. As suggested, only by downgrading fixes it for me, using -i didn't.

I have observed the same issue on Node 13.2.0 (where updating node is the only change since it was previously working reliably; package-lock.json has not changed, and I have tried before and after clearing out and rebuilding node_modules).

For me, running with --runInBand results in 8266 Segmentation fault: 11 at the same point where it otherwise fails with Call retries were exceeded at ChildProcessWorker.initialize. I am running on macOS 10.14.6 and installed node via Homebrew. After the crash it notes that it reached 33 passing test suites with 106 total tests. The codebase contains 34 test suites and 122 total tests (I don't know if these numbers are similar for other people hitting the issue?). I have many async tests in the rest of the code but the suite which hits this error contains only synchronous tests.

Since it's segfaulting, I suspect this is a bug in Node itself (seemingly a regression since this was an issue before), but I have no idea where to begin looking!


Is it possible that this could be connected to https://github.com/nodejs/node/pull/26628 ? (seems to be the only entry in the Node 13.2.0 changelog which relates to workers)

Appears this issue has been reported upstream: nodejs/node#30730

Hey guys! I was having this issue on CI only (CircleCI). So I changed the following value on CI config file and the issue has gone:

Before

version: 2
jobs:
  build:
    docker:
      - image: circleci/node:latest-browsers

Then

version: 2
jobs:
  build:
    docker:
      - image: circleci/node:12-browsers

_(note: not sure if this is the exact same error reason, but looks like it and I found this link when looking for a solution)_

Error:

Test suite failed to run Call retries were exceeded at ChildProcessWorker.initialize (node_modules/jest-worker/build/workers/ChildProcessWorker.js:193:21)

Confirmed fix:

Upgrade from nodejs 13.2.0 to 13.3.0

Environment

I had this error with
Windows 10
nodejs 13.2.0
Yarn 1.19.2

Package.json

"dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-redux": "^7.1.3",
    "react-scripts": "3.3.0",
    "redux": "^4.0.4"
  },
"devDependencies": {
    "@storybook/addon-actions": "^5.3.0-beta.16",
    "@storybook/addon-docs": "^5.3.0-beta.16",
    "@storybook/addon-knobs": "^5.3.0-beta.16",
    "@storybook/addon-links": "^5.3.0-beta.16",
    "@storybook/addon-storyshots": "^5.3.0-beta.16",
    "@storybook/addons": "^5.3.0-beta.16",
    "@storybook/preset-create-react-app": "^1.3.2",
    "@storybook/react": "^5.3.0-beta.16",
    "babel-loader": "^8.0.6",
    "react-test-renderer": "^16.12.0"
  }

Storybook initStoryshots from '@storybook/addon-storyshots'

When following the tutorial in https://www.learnstorybook.com/intro-to-storybook/react/en/simple-component/

The code below is where the error occured.

// src/storybook.test.js
import initStoryshots from '@storybook/addon-storyshots';
initStoryshots();

Believe got same issue on Node LTS 12.14.1:

ERROR in main.affbaa778346b006d3f5.js from Terser
Error: Call retries were exceeded
    at ChildProcessWorker.initialize (C:\azagent\A3\_work\1\s\Core\Web\NgApps\node_modules\jest-worker\build\workers\ChildProcessWorker.js:193:21)
    at ChildProcessWorker.onExit (C:\azagent\A3\_work\1\s\Core\Web\NgApps\node_modules\jest-worker\build\workers\ChildProcessWorker.js:263:12)
    at ChildProcess.emit (events.js:223:5)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)

What helped me was upgrading the runner machine to the one with more memory.

@mvasin how much memory has your machine now?

same with node 10.19.0, ubuntu 20.04

Working version for our builds: 12.16.3
Broken when upgrading to 12.18.0

Running 16GB memory, 8cpu on circleCI with the following options

yarn --coverage --ci -w 6

adding --runInBand, worked for me. I don't know why and I don't care as long as i see greens :green_circle: :see_no_evil:

any solution on this?

@justinlazaro-iselect you should probably check https://github.com/nodejs/node/issues/30730 since this is actually a NodeJS issue - I think the result is that this bug isn't fixed on Node 12 (yet? there seems to be talk about various dependencies on backporting things so it might be fixed eventually), but it is fixed in Node 13+

@davidje13 thanks for the info, will check right now I'm update to node v13.3.0 still having and issue call still having an issue Call retries were exceeded any workaround to react-script test for this?

I don't know if it helps anyone, but I was getting this error when running in a docker container on macOS, and I fixed it by increasing the memory available in Docker Desktop for Mac preferences.

It is a bit embarassing for us node devs that 2 cpu and 4gb ram cannot run unit tests properly :disappointed:

Well don't feel quite so bad, the default was 2gb ram and increasing to 4gb prevented this error 🙂

Just spotted this in the docs:

For environments with variable CPUs available, you can use percentage based configuration: --maxWorkers=50%

We're going to use this for a while and see whether this issue still happens.

Update: we've done a few builds since and haven't noticed any failures, so this looks like a good option.

This now produces actual errors and fails the test suite on Nodejs 15, where unhandled promise errors are treated as exceptions.

Was this page helpful?
0 / 5 - 0 ratings