Skip to content

fix(jest-worker): fail the call when the child process cannot send its result - #16481

Open
AdzerKI wants to merge 2 commits into
jestjs:mainfrom
AdzerKI:jest-worker-unsent-result
Open

AdzerKI wants to merge 2 commits into
jestjs:mainfrom
AdzerKI:jest-worker-unsent-result

Conversation

@AdzerKI

@AdzerKI AdzerKI commented Oct 3, 2026

Copy link
Copy Markdown

Summary

When process.send fails on the result of a call, reportSuccess in processChild retries with packMessage. If the second send fails as well, for example with RangeError: Invalid string length for a result too large to serialize, the error escapes reportSuccess:

  • for a sync call it is thrown out of the message listener and crashes the child, which gets the same call again after the restart until the retry limit is hit, and the caller ends up with the retry limit error instead of the cause;
  • for an async call it becomes an unhandled rejection; when the worker module listens to unhandledRejection, the child keeps running, the call never settles and the parent waits forever.

threadChild already reports the second failure as the error of the call. This does the same in processChild, so the call rejects with the actual error.

Test plan

  • New test in processChild.test.ts: both sends throw RangeError: Invalid string length, the call is reported with PARENT_MESSAGE_CLIENT_ERROR. It fails without the change (the RangeError escapes) and passes with it.
  • yarn jest packages/jest-worker: 14 suites, 153 tests pass.
  • yarn eslint and yarn prettier --check on the changed files, tsc -b of the jest-worker test projects after yarn build:ts.

@netlify

netlify Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 3771e09
🔍 Latest deploy log https://app.netlify.com/projects/jestjs/deploys/6ac074edf893d700088bbef2
😎 Deploy Preview https://deploy-preview-16481--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@github-actions github-actions Bot added the require-changelog If a PR does requires a changelog entry label Oct 3, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

babel-jest

npm i https://pkg.pr.new/babel-jest@16481

babel-plugin-jest-hoist

npm i https://pkg.pr.new/babel-plugin-jest-hoist@16481

babel-preset-jest

npm i https://pkg.pr.new/babel-preset-jest@16481

create-jest

npm i https://pkg.pr.new/create-jest@16481

@jest/diff-sequences

npm i https://pkg.pr.new/@jest/diff-sequences@16481

expect

npm i https://pkg.pr.new/expect@16481

@jest/expect-utils

npm i https://pkg.pr.new/@jest/expect-utils@16481

jest

npm i https://pkg.pr.new/jest@16481

jest-changed-files

npm i https://pkg.pr.new/jest-changed-files@16481

jest-circus

npm i https://pkg.pr.new/jest-circus@16481

jest-cli

npm i https://pkg.pr.new/jest-cli@16481

jest-config

npm i https://pkg.pr.new/jest-config@16481

@jest/console

npm i https://pkg.pr.new/@jest/console@16481

@jest/core

npm i https://pkg.pr.new/@jest/core@16481

@jest/create-cache-key-function

npm i https://pkg.pr.new/@jest/create-cache-key-function@16481

jest-diff

npm i https://pkg.pr.new/jest-diff@16481

jest-docblock

npm i https://pkg.pr.new/jest-docblock@16481

jest-each

npm i https://pkg.pr.new/jest-each@16481

@jest/environment

npm i https://pkg.pr.new/@jest/environment@16481

jest-environment-jsdom

npm i https://pkg.pr.new/jest-environment-jsdom@16481

@jest/environment-jsdom-abstract

npm i https://pkg.pr.new/@jest/environment-jsdom-abstract@16481

jest-environment-node

npm i https://pkg.pr.new/jest-environment-node@16481

@jest/expect

npm i https://pkg.pr.new/@jest/expect@16481

@jest/fake-timers

npm i https://pkg.pr.new/@jest/fake-timers@16481

@jest/get-type

npm i https://pkg.pr.new/@jest/get-type@16481

@jest/globals

npm i https://pkg.pr.new/@jest/globals@16481

jest-haste-map

npm i https://pkg.pr.new/jest-haste-map@16481

jest-jasmine2

npm i https://pkg.pr.new/jest-jasmine2@16481

jest-leak-detector

npm i https://pkg.pr.new/jest-leak-detector@16481

jest-matcher-utils

npm i https://pkg.pr.new/jest-matcher-utils@16481

jest-message-util

npm i https://pkg.pr.new/jest-message-util@16481

jest-mock

npm i https://pkg.pr.new/jest-mock@16481

@jest/pattern

npm i https://pkg.pr.new/@jest/pattern@16481

jest-phabricator

npm i https://pkg.pr.new/jest-phabricator@16481

jest-regex-util

npm i https://pkg.pr.new/jest-regex-util@16481

@jest/reporters

npm i https://pkg.pr.new/@jest/reporters@16481

jest-resolve

npm i https://pkg.pr.new/jest-resolve@16481

jest-resolve-dependencies

npm i https://pkg.pr.new/jest-resolve-dependencies@16481

jest-runner

npm i https://pkg.pr.new/jest-runner@16481

jest-runtime

npm i https://pkg.pr.new/jest-runtime@16481

@jest/schemas

npm i https://pkg.pr.new/@jest/schemas@16481

jest-snapshot

npm i https://pkg.pr.new/jest-snapshot@16481

@jest/snapshot-utils

npm i https://pkg.pr.new/@jest/snapshot-utils@16481

@jest/source-map

npm i https://pkg.pr.new/@jest/source-map@16481

@jest/test-result

npm i https://pkg.pr.new/@jest/test-result@16481

@jest/test-sequencer

npm i https://pkg.pr.new/@jest/test-sequencer@16481

@jest/transform

npm i https://pkg.pr.new/@jest/transform@16481

@jest/types

npm i https://pkg.pr.new/@jest/types@16481

jest-util

npm i https://pkg.pr.new/jest-util@16481

jest-validate

npm i https://pkg.pr.new/jest-validate@16481

jest-watcher

npm i https://pkg.pr.new/jest-watcher@16481

jest-worker

npm i https://pkg.pr.new/jest-worker@16481

pretty-format

npm i https://pkg.pr.new/pretty-format@16481

commit: 3771e09

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

require-changelog If a PR does requires a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant