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: clean event listener correctly #36424

Closed

Conversation

benjamingr
Copy link
Member

I was working on AbortSignal for spawn and noticed there is a leak in
the current code for AbortSignal support in child_process since it
removes the wrong listener. I used the new signal as argument feature
to make removing the listener easier and added a test.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@benjamingr benjamingr added child_process Issues and PRs related to the child_process subsystem. request-ci Add this label to start a Jenkins CI on a PR. labels Dec 7, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 7, 2020
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@benjamingr
Copy link
Member Author

@jasnell @addaleax @nodejs/child_process any chance this could get some reviews :] ?

@nodejs-github-bot
Copy link
Collaborator

options.signal.addEventListener('abort', () => {
if (!ex) {
Copy link
Member

Choose a reason for hiding this comment

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

Not blocking but: Unrelated style change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I just noticed it's different from the "common" way in other places in the event target code so I fixed my code there. Putting it in a new/different PR/commit seemed like overkill I think. I don't mind reverting it if it's an issue.

Copy link
Member

Choose a reason for hiding this comment

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

Nah, I just wanted to make sure there was a reason beyond personal preference. The inconsistency in curly brace usage throughout the code base bugs me, and I want to make sure any changes have a justification beyond personal preference. It will at least allow us to inch towards consistency. Maybe we'll get there by about 2027.

@benjamingr benjamingr added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 12, 2020
@github-actions github-actions bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 12, 2020
@github-actions
Copy link
Contributor

Commit Queue failed
- Loading data for nodejs/node/pull/36424
✔  Done loading data for nodejs/node/pull/36424
----------------------------------- PR info ------------------------------------
Title      child_process: clean event listener correctly (#36424)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     benjamingr:child-process-signal-leak -> nodejs:master
Labels     child_process
Commits    1
 - child_process: clean event listener correctly
Committers 1
 - Benjamin Gruenbaum 
PR-URL: https://github.com/nodejs/node/pull/36424
Reviewed-By: Anna Henningsen 
Reviewed-By: Rich Trott 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/36424
Reviewed-By: Anna Henningsen 
Reviewed-By: Rich Trott 
--------------------------------------------------------------------------------
   ✔  Last GitHub Actions successful
   ℹ  Last Full PR CI on 2020-12-09T18:28:27Z: https://ci.nodejs.org/job/node-test-pull-request/34880/
- Querying data for job/node-test-pull-request/34880/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
   ℹ  This PR was created on Mon, 07 Dec 2020 10:56:45 GMT
   ✔  Approvals: 2
   ✔  - Anna Henningsen (@addaleax): https://github.com/nodejs/node/pull/36424#pullrequestreview-548497636
   ✔  - Rich Trott (@Trott) (TSC): https://github.com/nodejs/node/pull/36424#pullrequestreview-550773859
   ⚠  This PR has conflicts that must be resolved
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/417460344

@github-actions github-actions bot added the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Dec 12, 2020
I was working on AbortSignal for spawn and noticed there is a leak in
the current code for AbortSignal support in child_process since it
removes the wrong listener. I used the new signal as argument feature
to make removing the listener easier and added a test.
@benjamingr benjamingr added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Dec 22, 2020
@github-actions github-actions bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Dec 22, 2020
@github-actions
Copy link
Contributor

Commit Queue failed
- Loading data for nodejs/node/pull/36424
✔  Done loading data for nodejs/node/pull/36424
----------------------------------- PR info ------------------------------------
Title      child_process: clean event listener correctly (#36424)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     benjamingr:child-process-signal-leak -> nodejs:master
Labels     child_process
Commits    1
 - child_process: clean event listener correctly
Committers 1
 - Benjamin Gruenbaum 
PR-URL: https://github.com/nodejs/node/pull/36424
Reviewed-By: Anna Henningsen 
Reviewed-By: Rich Trott 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/36424
Reviewed-By: Anna Henningsen 
Reviewed-By: Rich Trott 
--------------------------------------------------------------------------------
   ⚠  Commits were pushed since the last review:
   ⚠  - child_process: clean event listener correctly
   ✔  Last GitHub Actions successful
   ℹ  Last Full PR CI on 2020-12-12T14:34:53Z: https://ci.nodejs.org/job/node-test-pull-request/34880/
   ⚠  Commits were pushed after the last Full PR CI run:
   ⚠  - child_process: clean event listener correctly
- Querying data for job/node-test-pull-request/34880/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
   ℹ  This PR was created on Mon, 07 Dec 2020 10:56:45 GMT
   ✔  Approvals: 2
   ✔  - Anna Henningsen (@addaleax): https://github.com/nodejs/node/pull/36424#pullrequestreview-548497636
   ✔  - Rich Trott (@Trott) (TSC): https://github.com/nodejs/node/pull/36424#pullrequestreview-550773859
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/438143838

@benjamingr
Copy link
Member Author

Would be really useful if commit queue would know if I just rebased in a way that didn't actually change after review.

benjamingr added a commit that referenced this pull request Dec 22, 2020
I was working on AbortSignal for spawn and noticed there is a leak in
the current code for AbortSignal support in child_process since it
removes the wrong listener. I used the new signal as argument feature
to make removing the listener easier and added a test.

PR-URL: #36424
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@benjamingr
Copy link
Member Author

Landed in f0a0e3c

(Also, cool I didn't know that NCU actually tells you "2. Post "Landed in f0a0e3c" in #36424")

@benjamingr benjamingr closed this Dec 22, 2020
danielleadams pushed a commit that referenced this pull request Jan 12, 2021
I was working on AbortSignal for spawn and noticed there is a leak in
the current code for AbortSignal support in child_process since it
removes the wrong listener. I used the new signal as argument feature
to make removing the listener easier and added a test.

PR-URL: #36424
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@danielleadams danielleadams mentioned this pull request Jan 12, 2021
@targos targos added backport-open-v14.x and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Apr 24, 2021
targos pushed a commit to targos/node that referenced this pull request Apr 24, 2021
I was working on AbortSignal for spawn and noticed there is a leak in
the current code for AbortSignal support in child_process since it
removes the wrong listener. I used the new signal as argument feature
to make removing the listener easier and added a test.

PR-URL: nodejs#36424
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit to targos/node that referenced this pull request Apr 26, 2021
I was working on AbortSignal for spawn and noticed there is a leak in
the current code for AbortSignal support in child_process since it
removes the wrong listener. I used the new signal as argument feature
to make removing the listener easier and added a test.

PR-URL: nodejs#36424
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit to targos/node that referenced this pull request Apr 30, 2021
I was working on AbortSignal for spawn and noticed there is a leak in
the current code for AbortSignal support in child_process since it
removes the wrong listener. I used the new signal as argument feature
to make removing the listener easier and added a test.

PR-URL: nodejs#36424
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit that referenced this pull request Apr 30, 2021
I was working on AbortSignal for spawn and noticed there is a leak in
the current code for AbortSignal support in child_process since it
removes the wrong listener. I used the new signal as argument feature
to make removing the listener easier and added a test.

PR-URL: #36424
Backport-PR-URL: #38386
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@danielleadams danielleadams mentioned this pull request May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants