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

child_process: queue pending messages #41221

Conversation

ErickWendel
Copy link
Member

It fixes the problem for child process not receiving messages when forking a process and immediately sending messages on ESM by queuing messages until the process is ready.

Fixes: #41134
Refs: #37782, #39140, #39140, #34785, and help/issues/1383

@nodejs-github-bot nodejs-github-bot added child_process Issues and PRs related to the child_process subsystem. needs-ci PRs that need a full CI run. labels Dec 17, 2021
@ErickWendel ErickWendel force-pushed the erickwendel/queue-pending-messages-fork-process branch 2 times, most recently from 3b94fc1 to eb8c12a Compare December 17, 2021 15:21
lib/internal/child_process.js Outdated Show resolved Hide resolved
lib/internal/child_process.js Outdated Show resolved Hide resolved
lib/internal/child_process.js Outdated Show resolved Hide resolved
lib/internal/child_process.js Outdated Show resolved Hide resolved
lib/internal/child_process.js Outdated Show resolved Hide resolved
@ErickWendel ErickWendel force-pushed the erickwendel/queue-pending-messages-fork-process branch 3 times, most recently from da5b44c to eef3572 Compare December 17, 2021 15:50
@ErickWendel ErickWendel deleted the erickwendel/queue-pending-messages-fork-process branch December 17, 2021 15:55
@ErickWendel ErickWendel restored the erickwendel/queue-pending-messages-fork-process branch December 17, 2021 15:56
@ErickWendel ErickWendel reopened this Dec 17, 2021
Copy link
Member

@edsadr edsadr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good but pending from CI, will monitor and remove this once it passes

@ErickWendel ErickWendel force-pushed the erickwendel/queue-pending-messages-fork-process branch from eef3572 to 49abb89 Compare December 17, 2021 18:20
@aduh95
Copy link
Contributor

aduh95 commented Dec 17, 2021

Could you add a test please? Let me know if you need help writing one.

@ErickWendel
Copy link
Member Author

ErickWendel commented Dec 17, 2021

Could you add a test please? Let me know if you need help writing one.

There're tests for it before. The problem is that on ESM the behavior is different. As the coverage didn't change I didn't create a test for it. Do you think it's really necessary?

@aduh95
Copy link
Contributor

aduh95 commented Dec 17, 2021

Yes, we could simply copy the test we have and port it to ESM. It is necessary, otherwise another future change may break it again for ESM and we wouldn't be able to tell.

@ErickWendel ErickWendel force-pushed the erickwendel/queue-pending-messages-fork-process branch from 49abb89 to 0f48517 Compare December 17, 2021 19:07
@ErickWendel
Copy link
Member Author

Yes, we could simply copy the test we have and port it to ESM. It is necessary, otherwise another future change may break it again for ESM and we wouldn't be able to tell.

Got it! Let me know if this is what you suggested.

@ErickWendel ErickWendel force-pushed the erickwendel/queue-pending-messages-fork-process branch 3 times, most recently from 0168b1b to 100b785 Compare December 17, 2021 19:11
Linkgoron pushed a commit to Linkgoron/node that referenced this pull request Jan 31, 2022
It fixes the problem of the child process not receiving messages.

Fixes: nodejs#41134

PR-URL: nodejs#41221
Reviewed-By: Adrian Estrada <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
danielleadams pushed a commit that referenced this pull request Feb 1, 2022
It fixes the problem of the child process not receiving messages.

Fixes: #41134

PR-URL: #41221
Reviewed-By: Adrian Estrada <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
@danielleadams danielleadams mentioned this pull request Feb 1, 2022
mateus-f-torres added a commit to mateus-f-torres/barefoot that referenced this pull request Feb 7, 2022
Needed to resolve issue with Jest process (nodejs/node#41221)
mateus-f-torres added a commit to mateus-f-torres/barefoot that referenced this pull request Feb 9, 2022
Needed to resolve issue with Jest process (nodejs/node#41221)
mateus-f-torres added a commit to mateus-f-torres/barefoot that referenced this pull request Mar 24, 2022
Needed to resolve issue with Jest process (nodejs/node#41221)
mateus-f-torres added a commit to mateus-f-torres/barefoot that referenced this pull request Mar 24, 2022
Needed to resolve issue with Jest process (nodejs/node#41221)
@sublimator
Copy link

Will this be fixed in 14 LTS ?

@aduh95
Copy link
Contributor

aduh95 commented Apr 22, 2022

v14.x is in maintenance mode, meaning that no change land there unless someone opens a PR to backport it. See https://github.com/nodejs/node/blob/master/doc/contributing/backporting-to-release-lines.md for more info.

@ErickWendel
Copy link
Member Author

@aduh95 @sublimator just added a PR for backing porting this feature for 14.x. 🤩

@aduh95 aduh95 added backport-open-v14.x and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Apr 23, 2022
@juanarbol
Copy link
Member

Will this be fixed in 14 LTS ?

It will ❤️

juanarbol pushed a commit that referenced this pull request May 1, 2022
It fixes the problem of the child process not receiving messages.

Fixes: #41134

PR-URL: #41221
Reviewed-By: Adrian Estrada <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Backport-PR-URL: #42840
@juanarbol juanarbol mentioned this pull request May 1, 2022
tujoworker added a commit to dnbexperience/eufemia that referenced this pull request Jun 13, 2022
This version includes a fix so we can/would run jest with Yarn PnP: nodejs/node#41221
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. child_process Issues and PRs related to the child_process subsystem. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

discussion about how to fix child_process 'spawn' not ready to send messages on ESM