node/test/addons
Anna Henningsen 1723773d41
src: keep global list of addon-provided cleanup hooks
A recent change, 215027c8ed, introduced flakiness into our
test suite that exposed an issue with the cleanup hook API design.

Specifically, the signatures of `AddEnvironmentCleanupHook()` and
`RemoveEnvironmentCleanupHook()` are problematic. Both functions
take `Isolate*` arguments, as addons are not generally expected
to have to care about the Node.js `Environment` as a first-class
scope provider.

However, this model made the incorrect assumption that in the
situations in which `RemoveEnvironmentCleanupHook()` would be
invoked an `Environment` would always be associated with the
current `Isolate` (via the current V8 `Context`, if there is one).

This occasionally breaks down when `RemoveEnvironmentCleanupHook()`
is called during garbage collection -- which would be an expected
use case of the functionality, but one that has not been covered
through our tests before 215027c8ed.

Since Node.js guarantees API and ABI stability within a major version,
and this is a bug that is independent from the aforementioned change,
this commit resolves it by adding global mutable state to keep track
off cleanup hooks registered through the Node.js public API.

Obviously, this solution does not represent a desirable long-term
state, and a semver-minor follow up should add an API that does not
require modifications to these data structures, likely based on
the async cleanup hook API which already solves this issue properly.

Refs: https://github.com/nodejs/node/pull/63642
Fixes: https://github.com/nodejs/node/issues/63923
Signed-off-by: Anna Henningsen <anna@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/63985
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-06-21 00:06:55 +02:00
..
async-cleanup-hook
async-hello-world
async-hooks-id
async-resource test: add type tags to uses of v8::External 2026-04-27 07:59:17 -03:00
buffer-free-callback
callback-scope
cppgc-object
dlopen-ping-pong
errno-exception
esm
esm-export-default
esm-export-primitive
force-context-aware
heap-profiler
hello-world
hello-world-2
hello-world-function-export
load-long-path
make-callback
make-callback-domain-warning
make-callback-recurse
new-context-inspector src: expose node::RegisterContext to make a node managed context 2026-05-23 00:05:39 +02:00
new-isolate-addon
new-target
no-addons
node-module-version
non-node-context
not-a-binding
null-buffer-neuter
openssl-binding test: update test/addons/openssl-binding for OpenSSL 4.0 2026-05-05 16:19:32 +02:00
openssl-client-cert-engine deps: update OpenSSL build config to support compression 2026-06-20 16:58:11 +02:00
openssl-get-ssl-ctx test: update tls/crypto behaviour expectations when using BoringSSL 2026-05-19 21:38:38 +02:00
openssl-key-engine deps: update OpenSSL build config to support compression 2026-06-20 16:58:11 +02:00
openssl-providers test: forbid use of named imports for fixtures 2026-01-01 23:48:26 +00:00
openssl-test-engine deps: update OpenSSL build config to support compression 2026-06-20 16:58:11 +02:00
parse-encoding
register-signal-handler
repl-domain-abort
report-api
report-fatalerror
request-interrupt
stringbytes-external-exceed-max
symlinked-module
uv-handle-leak
uv-thread-name src: use node- prefix on thread names 2026-01-13 16:57:11 +00:00
worker-addon src: keep global list of addon-provided cleanup hooks 2026-06-21 00:06:55 +02:00
worker-addon-exit test: add regression test for using ObjectWrap in worker 2026-06-18 10:10:44 +02:00
worker-buffer-callback
zlib-binding
.gitignore
addons.status crypto: add crypto::GetSSLCtx API for addon access to OpenSSL contexts 2026-03-23 11:27:22 +00:00
common.gypi
testcfg.py