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

lib: disable default memory leak warning for AbortSignal #55816

Merged

Conversation

phryneas
Copy link
Contributor

@phryneas phryneas commented Nov 11, 2024

This change sets the default kMaxEventTargetListeners property for AbortSignal instances to 0, disabling the check per default, to enable users to write isomorphic library code.
If desirable, the max event target listeners check can still be enabled for individual AbortSignal instances by calling setMaxListeners on them.

Refs: #54758

I ran all the test I believe are relevant locally, but I can't run the full test suite as I'm working on a managed Mac and can't change firewall rules, so the test suite just explodes on me with popups.

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Nov 11, 2024
@phryneas
Copy link
Contributor Author

(I'm not allowed to add the notable-change label, so someone else will have to do that)

@benjamingr
Copy link
Member

@jasnell wdyt?

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

While I prefer having the warning in place, I won't block and the code change LGTM

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.00%. Comparing base (fe1dd26) to head (d0579b6).
Report is 167 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55816      +/-   ##
==========================================
+ Coverage   87.92%   88.00%   +0.08%     
==========================================
  Files         654      656       +2     
  Lines      187815   188984    +1169     
  Branches    35830    35997     +167     
==========================================
+ Hits       165139   166323    +1184     
+ Misses      15878    15832      -46     
- Partials     6798     6829      +31     
Files with missing lines Coverage Δ
lib/internal/abort_controller.js 98.06% <100.00%> (+<0.01%) ⬆️

... and 78 files with indirect coverage changes

@jazelly
Copy link
Member

jazelly commented Nov 27, 2024

The commit message should be under subsystem lib

@phryneas
Copy link
Contributor Author

@jazelly what's the correct course of action here?
Amend the commit, rewrite the existing commit title and force push?
I'm afraid that that will void all the commit approvals 😅

@phryneas phryneas changed the title internal: disable default memory leak warning for AbortSignal lib: disable default memory leak warning for AbortSignal Nov 28, 2024
@jazelly
Copy link
Member

jazelly commented Nov 28, 2024

what's the correct course of action here?
Amend the commit, rewrite the existing commit title and force push?

Yes, the commit needs to be amended to pass the GHA, so that we can run CI.

I'm afraid that that will void all the commit approvals.

Technically, you just need one more approval / request re-review from the approvers after force pushing.

@phryneas phryneas force-pushed the pr/abortsignal-maxlisteners branch from f967e1a to e0125f3 Compare November 29, 2024 11:36
@phryneas
Copy link
Contributor Author

phryneas commented Nov 29, 2024

@jazelly Okay, thank you for clarifying - I've adjusted the commit message!

Apart from the commit message, the commits are identical

@jazelly
Copy link
Member

jazelly commented Nov 30, 2024

The first-line commit message needs to be less than 72 characters. Can you please update the commit?

More detailed guideline can be found here. Sorry, probably should've link that in my previous message.

@phryneas
Copy link
Contributor Author

phryneas commented Dec 2, 2024

I followed that guide 😓

The first line should:

contain a short description of the change (preferably 50 characters or less, and no more than 72 characters)

✅ description is 51 characters, plus the lib: prefix

be entirely in lowercase with the exception of proper nouns, acronyms, and the words that refer to code, like function/variable names

✅ everything lowercase except for AbortController

be prefixed with the name of the changed subsystem and start with an imperative verb. Check the output of git log --oneline files/you/changed to find out what subsystems your changes touch.

From the suffix:

lib/*.js (assert, buffer, etc.)

which is why I came up with internal in the first place, because this is in lib/internal.


Looking at this, it seems I failed on the subsequent lines - one line is 76 chars long. I probably trusted my local editor which warns at 80.

Fixing...

This change sets the default `kMaxEventTargetListeners` property for
`AbortSignal` instances to 0, disabling the check per default, to
enable users to write isomorphic library code.
If desirable, the max event target listeners check can still be
enabled for individual `AbortSignal` instances by calling
`setMaxListeners` on them.

Refs: nodejs#54758
@phryneas phryneas force-pushed the pr/abortsignal-maxlisteners branch from e0125f3 to d0579b6 Compare December 2, 2024 08:51
@phryneas
Copy link
Contributor Author

phryneas commented Dec 2, 2024

@jazelly I've run the check locally via

git rev-parse HEAD~0 | xargs npx -q core-validate-commit --no-validate-metadata --tap

and it seems to pass now.

@jazelly jazelly added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 4, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 4, 2024
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Dec 4, 2024

@jazelly jazelly added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed needs-ci PRs that need a full CI run. labels Dec 5, 2024
@aduh95 aduh95 added needs-ci PRs that need a full CI run. commit-queue Add this label to land a pull request using GitHub Actions. labels Dec 7, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 7, 2024
@nodejs-github-bot nodejs-github-bot merged commit c1ccade into nodejs:main Dec 7, 2024
67 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in c1ccade

aduh95 pushed a commit that referenced this pull request Dec 10, 2024
This change sets the default `kMaxEventTargetListeners` property for
`AbortSignal` instances to 0, disabling the check per default, to
enable users to write isomorphic library code.
If desirable, the max event target listeners check can still be
enabled for individual `AbortSignal` instances by calling
`setMaxListeners` on them.

Refs: #54758
PR-URL: #55816
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
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. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants