Skip to content

events: fix addAbortListener for aborted signals - #65640

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
lazerg:fix/issue-65637-abort-listener-disposal
Sep 26, 2026
Merged

nodejs-github-bot merged 1 commit into
nodejs:mainfrom
lazerg:fix/issue-65637-abort-listener-disposal

Conversation

@lazerg

@lazerg lazerg commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

When addAbortListener() is given a signal that is already aborted, it queues listener() with no arguments and leaves the returned disposable empty. So the callback gets undefined where every other path hands it the abort event, and disposing before the microtask runs does not stop it from firing.

The aborted branch now builds a trusted abort event with the same target and dispatch state the real listener would see, and its dispose handler cancels the pending microtask.

Fixes #65637

@nodejs-github-bot nodejs-github-bot added events Issues and PRs related to EventEmitter and the events module. needs-ci PRs that need a full CI run. labels Aug 29, 2026
Signed-off-by: Lazizbek Ergashev <lazerg2@gmail.com>
@lazerg
lazerg force-pushed the fix/issue-65637-abort-listener-disposal branch from 1830f2a to eca0fdb Compare August 29, 2026 08:47
@codecov

codecov Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.06%. Comparing base (2f469df) to head (eca0fdb).
⚠️ Report is 606 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65640      +/-   ##
==========================================
+ Coverage   90.04%   90.06%   +0.01%     
==========================================
  Files         754      754              
  Lines      255722   255738      +16     
  Branches    48312    48311       -1     
==========================================
+ Hits       230274   230320      +46     
+ Misses      16553    16544       -9     
+ Partials     8895     8874      -21     
Files with missing lines Coverage Δ
lib/internal/event_target.js 98.80% <100.00%> (+<0.01%) ⬆️
lib/internal/events/abort_listener.js 100.00% <100.00%> (ø)

... and 29 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@inoway46 inoway46 added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 25, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 25, 2026
@nodejs-github-bot

This comment has been minimized.

@panva panva added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Sep 25, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95

aduh95 commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Can you please rebase to address the following failure EDIT: nevermind the CI actually rebases for us, I'll just kick a new one

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@panva panva added the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 26, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 261c8a1 into nodejs:main Sep 26, 2026
76 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 261c8a1

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 26, 2026
aduh95 pushed a commit that referenced this pull request Sep 27, 2026
Signed-off-by: Lazizbek Ergashev <lazerg2@gmail.com>
PR-URL: #65640
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
HoonDongKang pushed a commit to HoonDongKang/node that referenced this pull request Sep 28, 2026
Signed-off-by: Lazizbek Ergashev <lazerg2@gmail.com>
PR-URL: nodejs#65640
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
aduh95 pushed a commit that referenced this pull request Sep 28, 2026
Signed-off-by: Lazizbek Ergashev <lazerg2@gmail.com>
PR-URL: #65640
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. events Issues and PRs related to EventEmitter and the events module. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

events: addAbortListener ignores disposal and passes undefined event when signal is already aborted

7 participants