GeezerVison is showing github.com — process: return unregister fn from finalization by mcollina · Pull Request #66482 · nodejs/node
Conversation
mcollina
commented
Oct 3, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
process.finalization.register() and process.finalization.registerBeforeExit() now return a function that removes that specific registration:
const unregister = process.finalization.register(obj, onExit);
// later
unregister();
Other registrations for the same object are left in place, calling the function more than once is a no-op, and the function does not hold a strong reference to obj.
Each registration now uses its WeakRef as the FinalizationRegistry unregister token. This also fixes process.finalization.unregister(obj), which called registry.unregister(obj) although obj was never passed as a token, so the registry entries were never removed.
AI generated. Reviewed by me.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
bricss reacted with rocket emoji
codecov
Bot
commented
Oct 3, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.49%. Comparing base (77609be) to head (9912e54).
⚠️ Report is 15 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #66482 +/- ##
==========================================
- Coverage 92.85% 90.49% -2.36%
==========================================
Files 428 797 +369
Lines 194693 277665 +82972
Branches 30091 53346 +23255
==========================================
+ Hits 180774 251270 +70496
- Misses 13593 16795 +3202
- Partials 326 9600 +9274
... and 498 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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Commit Queue failed
✖ This PR needs to wait 5 more hours to land (or 0 minutes if there is one more approval)
⚠ This PR has conflicts that must be resolved
The pull request was removed from the Commit Queue and labeled
commit-queue-failed
PRs whose Commit Queue landing failed and need manual intervention before retrying.
. After resolving the failure, remove that label and add
commit-queue
PRs queued for automated landing through the Commit Queue.
to retry.
Full Commit Queue output
�[36m⠋�[39m Loading data for nodejs/node/pull/66482
�[36m⠋�[39m Loading data for nodejs/node/pull/66482
�[36m⠋�[39m Getting collaborator contacts from README of nodejs/node
�[36m⠋�[39m Getting PR from nodejs/node/pull/66482
�[36m⠋�[39m Getting reviews from nodejs/node/pull/66482
�[36m⠋�[39m Getting comments from nodejs/node/pull/66482
�[36m⠋�[39m Getting commits from nodejs/node/pull/66482
✔ Done loading data for nodejs/node/pull/66482
----------------------------------- PR info ------------------------------------
Title process: return unregister fn from finalization (#66482)
Author Matteo Collina <[email protected]> (@mcollina)
Branch mcollina:process-finalization-unregister-fn -> nodejs:main
Labels process, needs-ci, commit-queue, lacks-second-approval
Commits 1
- process: return unregister fn from finalization
Committers 1
- Matteo Collina <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/66482
Reviewed-By: James M Snell <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/66482
Reviewed-By: James M Snell <[email protected]>
--------------------------------------------------------------------------------
ℹ This PR was created on Sat, 03 Oct 2026 14:33:02 GMT
✔ Approvals: 1
✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/66482#pullrequestreview-5420245948
✖ This PR needs to wait 5 more hours to land (or 0 minutes if there is one more approval)
⚠ This PR has conflicts that must be resolved
✔ Last GitHub CI successful
ℹ Last Full PR CI on 2026-10-09T15:16:09Z: https://ci.nodejs.org/job/node-test-pull-request/78271/
�[36m⠙�[39m Querying data for job/node-test-pull-request/78271/
�[36m⠙�[39m Querying data for job/node-test-pull-request/78271/
�[36m⠙�[39m Querying API for job/node-test-pull-request/78271/
✔ Build data downloaded
✔ Last Jenkins CI successful
--------------------------------------------------------------------------------
✔ Aborted `git node land` session in /home/runner/work/node/node/.ncu
View workflow run
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Commit Queue failed
⚠ This PR has conflicts that must be resolved
The pull request was removed from the Commit Queue and labeled
commit-queue-failed
PRs whose Commit Queue landing failed and need manual intervention before retrying.
. After resolving the failure, remove that label and add
commit-queue
PRs queued for automated landing through the Commit Queue.
to retry.
Full Commit Queue output
�[36m⠋�[39m Loading data for nodejs/node/pull/66482
�[36m⠋�[39m Loading data for nodejs/node/pull/66482
�[36m⠋�[39m Getting collaborator contacts from README of nodejs/node
�[36m⠋�[39m Getting PR from nodejs/node/pull/66482
�[36m⠋�[39m Getting reviews from nodejs/node/pull/66482
�[36m⠋�[39m Getting comments from nodejs/node/pull/66482
�[36m⠋�[39m Getting commits from nodejs/node/pull/66482
✔ Done loading data for nodejs/node/pull/66482
----------------------------------- PR info ------------------------------------
Title process: return unregister fn from finalization (#66482)
Author Matteo Collina <[email protected]> (@mcollina)
Branch mcollina:process-finalization-unregister-fn -> nodejs:main
Labels process, needs-ci, commit-queue
Commits 1
- process: return unregister fn from finalization
Committers 1
- Matteo Collina <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/66482
Reviewed-By: James M Snell <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/66482
Reviewed-By: James M Snell <[email protected]>
--------------------------------------------------------------------------------
ℹ This PR was created on Sat, 03 Oct 2026 14:33:02 GMT
✔ Approvals: 1
✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/66482#pullrequestreview-5420245948
⚠ This PR has conflicts that must be resolved
✔ Last GitHub CI successful
ℹ Last Full PR CI on 2026-10-10T10:21:45Z: https://ci.nodejs.org/job/node-test-pull-request/78271/
�[36m⠙�[39m Querying data for job/node-test-pull-request/78271/
�[36m⠙�[39m Querying data for job/node-test-pull-request/78271/
�[36m⠙�[39m Querying API for job/node-test-pull-request/78271/
✔ Last Jenkins CI successful
--------------------------------------------------------------------------------
�[36m⠹�[39m Querying API for job/node-test-pull-request/78271/
✔ Aborted `git node land` session in /home/runner/work/node/node/.ncu
View workflow run
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
mcollina
added
resume-ci
Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review.
semver-minor
PRs that contain new features and should be released in the next minor version.
and removed
commit-queue-failed
PRs whose Commit Queue landing failed and need manual intervention before retrying.
labels
Oct 14, 2026
Failed to resume CI
✖ test/parallel/test-process-finalization.mjs
ℹ https://ci.nodejs.org/job/node-test-binary-windows-js-suites/RUN_SUBSET=2,nodes=win11-vs2022-arm64-COMPILED_BY-vs2022_clang-arm64/43879/consoleText
✖ Refusing to resume CI: failures reference files changed by this PR
Full Auto Start CI output
�[36m⠋�[39m Validating Jenkins credentials
�[36m⠋�[39m Validating Jenkins credentials
✔ Jenkins credentials valid
�[36m⠙�[39m Looking for CI runs for pull request 66482
�[36m⠙�[39m Looking for CI runs for pull request 66482
�[36m⠙�[39m Getting PR from nodejs/node/pull/66482
�[36m⠙�[39m Getting reviews from nodejs/node/pull/66482
�[36m⠙�[39m Getting comments from nodejs/node/pull/66482
✔ Found PR CI job 78353
�[36m⠹�[39m Querying data for job/node-test-pull-request/78353/
�[36m⠹�[39m Querying data for job/node-test-pull-request/78353/
�[36m⠹�[39m Querying API for job/node-test-pull-request/78353/
✔ Build data downloaded
�[36m⠹�[39m Checking whether PR CI job 78353 can be resumed
�[36m⠹�[39m Checking whether PR CI job 78353 can be resumed
✔ Jenkins offers a Resume build action
�[36m⠸�[39m Checking failures against changed PR files
�[36m⠸�[39m Checking failures against changed PR files
�[36m⠼�[39m Querying data for job/node-test-pull-request/78353/
�[36m⠼�[39m Querying API for job/node-test-pull-request/78353/
✔ Build data downloaded
�[36m⠴�[39m Querying failures of job/node-test-commit/93223/
�[36m⠴�[39m Querying failures of job/node-test-commit/93223/
�[36m⠴�[39m Querying API for job/node-test-commit-windows-fanned/81155/
�[36m⠴�[39m Querying API for job/node-test-binary-windows-js-suites/43879/
�[36m⠦�[39m Querying API for job/node-test-binary-windows-js-suites/RUN_SUBSET=1,nodes=win2016-COMPILED_BY-vs2022-x86/43865/
�[36m⠦�[39m Querying API for job/node-test-binary-windows-js-suites/RUN_SUBSET=2,nodes=win11-vs2022-arm64-COMPILED_BY-vs2022_clang-arm64/43879/
�[36m⠧�[39m Querying console text for job/node-test-binary-windows-js-suites/RUN_SUBSET=2,nodes=win11-vs2022-arm64-COMPILED_BY-vs2022_clang-arm64/43879/
✔ Data downloaded
✖ test/parallel/test-process-finalization.mjs
ℹ https://ci.nodejs.org/job/node-test-binary-windows-js-suites/RUN_SUBSET=2,nodes=win11-vs2022-arm64-COMPILED_BY-vs2022_clang-arm64/43879/consoleText
not ok 909 parallel/test-process-finalization
---
duration_ms: 2388.99700
severity: fail
exitcode: 1
stack: |-
Test failure: 'should exit file unregister-function.mjs with code=0'
Location: test\parallel\test-process-finalization.mjs:20:3
Error: - process terminated with status 1, expected 0
at TestContext.<anonymous> (file:///d:/workspace/node-test-binary-windows-js-suites/node/test/parallel/test-process-finalization.mjs:21:5)
at Test.runInAsyncScope (node:async_hooks:227:14)
at Test.run (node:internal/test_runner/test:1402:25)
at Test.processPendingSubtests (node:internal/test_runner/test:974:18)
at Test.postRun (node:internal/test_runner/test:1542:19)
at Test.run (node:internal/test_runner/test:1467:12)
at async Test.processPendingSubtests (node:internal/test_runner/test:974:7) {
options: {
cwd: 'd:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\fixtures\\process'
},
command: 'd:\\workspace\\node-test-binary-windows-js-suites\\node\\Release\\node.exe --expose-gc unregister-function.mjs'
}
[process 12116]: --- stderr ---
node:internal/assert/utils:146
throw error;
^
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
'' !== 'b:exit'
at process.<anonymous> (file:///d:/workspace/node-test-binary-windows-js-suites/node/test/fixtures/process/unregister-function.mjs:28:3)
at process.emit (node:events:514:20) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: '',
expected: 'b:exit',
operator: 'strictEqual',
diff: 'simple'
}
Node.js v27.0.0-pre
[process 12116]: --- stdout ---
[process 12116]: status = 1, signal = null
...
✖ Refusing to resume CI: failures reference files changed by this PR
View workflow run
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
mcollina
added a commit
to mcollina/node
that referenced
this pull request
Oct 16, 2026
The `changes` lists for `process.finalization.register()` and
`process.finalization.registerBeforeExit()` must be ordered newest first.
PR nodejs#66436 (marking these APIs as release candidate) has already landed in
`main` at v26.12.0, so the new nodejs#66482 (REPLACEME) entry must come before
it. Leaving both as REPLACEME makes the merged file out of order and fails
the `lint-md` check.
Refs: nodejs#66482
Signed-off-by: Matteo Collina <[email protected]>
Assisted-by: pi
mcollina
added a commit
to mcollina/node
that referenced
this pull request
Oct 16, 2026
process.finalization.register() and registerBeforeExit() now return
a function that removes only that registration, leaving other
registrations for the same object in place. The function does not
hold a strong reference to the object.
Each registration now uses its WeakRef as the unregister token, which
also makes process.finalization.unregister() remove the entries from
the FinalizationRegistry; previously it passed the object as the
token, which was never registered, so the call had no effect.
Refs: nodejs#66482
Signed-off-by: Matteo Collina <[email protected]>
Assisted-by: pi
process.finalization.register() and registerBeforeExit() now return
a function that removes only that registration, leaving other
registrations for the same object in place. The function does not
hold a strong reference to the object.
Each registration now uses its WeakRef as the unregister token, which
also makes process.finalization.unregister() remove the entries from
the FinalizationRegistry; previously it passed the object as the
token, which was never registered, so the call had no effect.
Refs: nodejs#66482
Signed-off-by: Matteo Collina <[email protected]>
Assisted-by: pi
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
aduh95
pushed a commit
that referenced
this pull request
Nov 12, 2026
process.finalization.register() and registerBeforeExit() now return
a function that removes only that registration, leaving other
registrations for the same object in place. The function does not
hold a strong reference to the object.
Each registration now uses its WeakRef as the unregister token, which
also makes process.finalization.unregister() remove the entries from
the FinalizationRegistry; previously it passed the object as the
token, which was never registered, so the call had no effect.
Refs: #66482
Signed-off-by: Matteo Collina <[email protected]>
Assisted-by: pi
PR-URL: #66482
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
aduh95
pushed a commit
that referenced
this pull request
Nov 13, 2026
process.finalization.register() and registerBeforeExit() now return
a function that removes only that registration, leaving other
registrations for the same object in place. The function does not
hold a strong reference to the object.
Each registration now uses its WeakRef as the unregister token, which
also makes process.finalization.unregister() remove the entries from
the FinalizationRegistry; previously it passed the object as the
token, which was never registered, so the call had no effect.
Refs: #66482
Signed-off-by: Matteo Collina <[email protected]>
Assisted-by: pi
PR-URL: #66482
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
nodejs-github-bot
added a commit
that referenced
this pull request
Nov 20, 2026
Notable changes:
benchmark:
* (SEMVER-MINOR) add http header validator benchmark (James M Snell) #66334
buffer:
* (SEMVER-MINOR) add Buffer.stringLength() (Matteo Collina) #66064
* (SEMVER-MINOR) add isLatin1 (James M Snell) #66298
doc:
* (SEMVER-MINOR) promote Alpine Linux to tier 2 support (Stewart X Addison) #63737
http:
* (SEMVER-MINOR) add isValidHeaderName() and isValidHeaderValue() (James M Snell) #66334
perf_hooks:
* (SEMVER-MINOR) add histogram.diff() (James M Snell) #66099
* (SEMVER-MINOR) add histogram.snapshot() (James M Snell) #66099
* (SEMVER-MINOR) harden histogram CBOR import validation (James M Snell) #66098
process:
* (SEMVER-MINOR) return unregister fn from finalization (Matteo Collina) #66482
* (SEMVER-MINOR) graduate process.ref/unref from experimental (James M Snell) #66213
test_runner:
* use AsyncLocalStorage instead of async_hooks (Matteo Collina) #66795
* (SEMVER-MINOR) add support for --test-coverage-include-all (Aviv Keller) #64830
PR-URL: #67663
nodejs-github-bot
added a commit
that referenced
this pull request
Nov 20, 2026
Notable changes:
child_process:
* (SEMVER-MINOR) add subprocess.timedOut (Marco) #66639
doc:
* add efekrskl to collaborators (Efe Karasakal) #67376
* add Philipp Dunkel to contributors (Philipp Dunkel) #67378
* add christianaurichzm to collaborators (Christian Aurich Zanettini Martins) #67377
fs:
* (SEMVER-MINOR) add mkstemp() (Marco) #66484
http:
* (SEMVER-MINOR) batch body spans per parser execute (Guilherme Araújo) #67187
lib:
* (SEMVER-MINOR) speed up AbortSignal (Robert Nagy) #66789
module:
* (SEMVER-MINOR) add --experimental-strip-private-modules (Marco Ippolito) #63869
process:
* (SEMVER-MINOR) return unregister fn from finalization (Matteo Collina) #66482
test_runner:
* use AsyncLocalStorage instead of async_hooks (Matteo Collina) #66795
* (SEMVER-MINOR) add mockReturnValue and promise helpers (Guilherme Araújo) #66631
worker:
* (SEMVER-MINOR) preload streams into startup snapshot (Matteo Collina) #66311
zlib:
* (SEMVER-MINOR) add crc32c (Philipp Dunkel) #66828
PR-URL: #67664
aduh95
added a commit
that referenced
this pull request
Nov 21, 2026
Notable changes:
buffer:
* (SEMVER-MINOR) add Buffer.stringLength() (Matteo Collina) #66064
* (SEMVER-MINOR) add isLatin1 (James M Snell) #66298
doc:
* (SEMVER-MINOR) promote Alpine Linux to tier 2 support (Stewart X Addison) #63737
http:
* (SEMVER-MINOR) add isValidHeaderName() and isValidHeaderValue() (James M Snell) #66334
perf_hooks:
* (SEMVER-MINOR) add histogram.diff() (James M Snell) #66099
* (SEMVER-MINOR) add histogram.snapshot() (James M Snell) #66099
* (SEMVER-MINOR) harden histogram CBOR import validation (James M Snell) #66098
process:
* (SEMVER-MINOR) return unregister fn from finalization (Matteo Collina) #66482
* (SEMVER-MINOR) graduate process.ref/unref from experimental (James M Snell) #66213
test_runner:
* use AsyncLocalStorage instead of async_hooks (Matteo Collina) #66795
* (SEMVER-MINOR) add support for --test-coverage-include-all (Aviv Keller) #64830
PR-URL: #67663
aduh95
added a commit
that referenced
this pull request
Nov 21, 2026
Notable changes:
child_process:
* (SEMVER-MINOR) add subprocess.timedOut (Marco) #66639
doc:
* add efekrskl to collaborators (Efe Karasakal) #67376
* add Philipp Dunkel to contributors (Philipp Dunkel) #67378
* add christianaurichzm to collaborators (Christian Aurich Zanettini Martins) #67377
fs:
* (SEMVER-MINOR) add mkstemp() (Marco) #66484
http:
* (SEMVER-MINOR) batch body spans per parser execute (Guilherme Araújo) #67187
lib:
* (SEMVER-MINOR) speed up AbortSignal (Robert Nagy) #66789
module:
* (SEMVER-MINOR) add --experimental-strip-private-modules (Marco Ippolito) #63869
process:
* (SEMVER-MINOR) return unregister fn from finalization (Matteo Collina) #66482
test_runner:
* use AsyncLocalStorage instead of async_hooks (Matteo Collina) #66795
* (SEMVER-MINOR) add mockReturnValue and promise helpers (Guilherme Araújo) #66631
worker:
* (SEMVER-MINOR) preload streams into startup snapshot (Matteo Collina) #66311
zlib:
* (SEMVER-MINOR) add crc32c (Philipp Dunkel) #66828
PR-URL: #67664
aduh95
added a commit
that referenced
this pull request
Nov 21, 2026
Notable changes:
buffer:
* (SEMVER-MINOR) add Buffer.stringLength() (Matteo Collina) #66064
* (SEMVER-MINOR) add isLatin1 (James M Snell) #66298
doc:
* (SEMVER-MINOR) promote Alpine Linux to tier 2 support (Stewart X Addison) #63737
http:
* (SEMVER-MINOR) add isValidHeaderName() and isValidHeaderValue() (James M Snell) #66334
perf_hooks:
* (SEMVER-MINOR) add histogram.diff() (James M Snell) #66099
* (SEMVER-MINOR) add histogram.snapshot() (James M Snell) #66099
* (SEMVER-MINOR) harden histogram CBOR import validation (James M Snell) #66098
process:
* (SEMVER-MINOR) return unregister fn from finalization (Matteo Collina) #66482
* (SEMVER-MINOR) graduate process.ref/unref from experimental (James M Snell) #66213
test_runner:
* use AsyncLocalStorage instead of async_hooks (Matteo Collina) #66795
* (SEMVER-MINOR) add support for --test-coverage-include-all (Aviv Keller) #64830
PR-URL: #67663
gabylb
pushed a commit
to gabylb/node
that referenced
this pull request
Nov 27, 2026
process.finalization.register() and registerBeforeExit() now return
a function that removes only that registration, leaving other
registrations for the same object in place. The function does not
hold a strong reference to the object.
Each registration now uses its WeakRef as the unregister token, which
also makes process.finalization.unregister() remove the entries from
the FinalizationRegistry; previously it passed the object as the
token, which was never registered, so the call had no effect.
Refs: nodejs#66482
Signed-off-by: Matteo Collina <[email protected]>
Assisted-by: pi
PR-URL: nodejs#66482
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
Reviewers
jasnell
jasnell approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
needs-ci
PRs that need a full CI run.
process
Issues and PRs related to the process subsystem.
semver-minor
PRs that contain new features and should be released in the next minor version.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|