node/lib/internal
Trivikram Kamat 75aec8ecf8
process: fix finalization cleanup ref tracking
Use SafeSet collections for finalization refs so insertion, removal,
and emptiness checks match the identity-based tracking model.

This also fixes cleanup removal for collected refs. Previously cleanup
used the ref index as the splice delete count, which could remove later
live refs when the collected ref was not first.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64087
Fixes: https://github.com/nodejs/node/issues/64086
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
2026-06-30 21:38:02 +00:00
..
assert
async_local_storage lib: add lint rule to enforce use of kEmptyObject 2026-06-10 10:56:56 +00:00
bootstrap
child_process child_process: serialize advanced IPC messages natively 2026-06-18 18:14:46 +00:00
cluster
console
crypto typings: add typing for crypto 2026-06-27 11:50:27 +02:00
debugger debugger: lazily wait for initial break output 2026-06-22 05:55:33 +00:00
dns dns,net: reject hostnames with embedded NUL bytes 2026-06-18 06:29:24 +02:00
dtls
encoding
errors
events events: improve addAbortListener perf by caching options object 2026-06-08 18:00:33 +02:00
ffi ffi: add experimental fast FFI call API for AArch64 and x86_64 2026-06-16 09:35:02 +00:00
fs fs: do not treat EPERM as ENOTEMPTY on Windows 2026-06-21 01:31:38 +00:00
http2 http2: cap originSet size to prevent unbounded memory growth 2026-06-18 06:29:23 +02:00
inspector lib: add lint rule to enforce use of kEmptyObject 2026-06-10 10:56:56 +00:00
legacy
main watch: print name of changed file that triggers restart 2026-06-22 05:55:19 +00:00
modules esm: add --experimental-import-text flag 2026-06-26 13:50:21 +00:00
per_context lib: improve control abstraction coverage in frozen intrinsics 2026-06-13 17:31:17 +00:00
perf perf_hooks: sample delay per event loop iteration 2026-06-24 23:50:06 +00:00
process process: fix finalization cleanup ref tracking 2026-06-30 21:38:02 +00:00
quic quic: expose QUIC certificates as JS X509Certificate, not raw handles 2026-06-20 20:11:47 +00:00
readline lib: add lint rule to enforce use of kEmptyObject 2026-06-10 10:56:56 +00:00
repl repl: lazy-load acorn and defer vm context creation 2026-06-23 18:44:53 +09:00
source_map
streams stream: normalize Broadcast.from() byte inputs 2026-06-30 06:25:00 +00:00
test
test_runner test_runner: filter execArgv fallback for child tests 2026-06-29 07:04:46 +00:00
tls crypto,https,tls: runtime-deprecate OpenSSL engine-based APIs (DEP0183) 2026-06-19 18:03:51 +02:00
util util: fix OOM in inspect color stack formatting 2026-06-23 19:21:47 +00:00
v8 lib: add lint rule to enforce use of kEmptyObject 2026-06-10 10:56:56 +00:00
vfs vfs: avoid recursive readdir symlink cycles 2026-06-30 10:08:40 +00:00
vm
watch_mode watch: print name of changed file that triggers restart 2026-06-22 05:55:19 +00:00
webstreams stream: fix Writable.toWeb() desiredSize for non-object-mode 2026-06-21 21:56:57 +00:00
worker
abort_controller.js
assert.js
async_context_frame.js
async_hooks.js domain: port to AsyncLocalStorage 2026-06-21 19:42:03 +00:00
blob.js buffer: implement blob.textStream() 2026-06-22 23:40:44 +00:00
blocklist.js net: coerce -0 to +0 in BlockList prefixes 2026-05-31 14:25:30 +00:00
buffer.js
child_process.js child_process: pass spawn options to the binding positionally 2026-06-20 15:45:11 +00:00
cli_table.js
constants.js
data_url.js
dgram.js dgram: skip dns.lookup() for literal IP addresses 2026-06-30 13:07:49 +00:00
encoding.js
error_serdes.js
errors.js domain: port to AsyncLocalStorage 2026-06-21 19:42:03 +00:00
event_target.js lib: lazily initialize kEvents and kHandlers maps 2026-06-23 16:19:28 +00:00
ffi-shared-buffer.js ffi: add experimental fast FFI call API for AArch64 and x86_64 2026-06-16 09:35:02 +00:00
file.js
fixed_queue.js
freelist.js
freeze_intrinsics.js lib: improve control abstraction coverage in frozen intrinsics 2026-06-13 17:31:17 +00:00
heap_utils.js
histogram.js
http.js lib,test: redact proxy credentials in tunnel errors 2026-06-18 06:29:23 +02:00
inspector_async_hook.js
inspector_network_tracking.js
js_stream_socket.js
linkedlist.js
locks.js
mime.js
navigator.js lib: make Navigator#language getter throw on invalid this 2026-06-02 14:25:47 +02:00
net.js net: support TCP_KEEPINTVL and TCP_KEEPCNT in setKeepAlive 2026-06-13 23:12:25 +00:00
options.js
priority_queue.js
promise_hooks.js
querystring.js
README.md
repl.js
socket_list.js
socketaddress.js
stream_base_commons.js
timers.js
trace_events_async_hooks.js
tty.js
url.js url: fix URLSearchParams(null) to prudce null= per spec 2026-06-09 07:40:15 +00:00
util.js util: remove unused functions 2026-05-30 09:05:23 +00:00
v8_prof_polyfill.js
validators.js dns,net: reject hostnames with embedded NUL bytes 2026-06-18 06:29:24 +02:00
vm.js
wasm_web_api.js
watchdog.js
webidl.js
webstorage.js
worker.js

Internal Modules

The modules located in lib/internal directory are exclusively meant for internal usage within the Node.js core. They are not intended to be accessed via user modules require(). These modules may change at any point in time. Relying on these internal modules outside the core is not supported and can lead to unpredictable behavior.

In certain scenarios, accessing these internal modules for debugging or experimental purposes might be necessary. Node.js provides the --expose-internals flag to expose these modules to userland code. This flag only exists to assist Node.js maintainers with debugging internals. It is not meant for use outside the project.