perf_hooks: fix scheduling regression
Scheduling a PerformanceGCCallback
should not keep the event loop alive but due to the recent switch to using the native SetImmediate
method, it does. Go back to using uv_async_t
and add a regression test.
The reason this was uncovered by the http2
binding is that it takes just long enough to do the GC on all the string constants that it creates that this race condition was triggered. (I finally uncovered this when the problem went away simply by commenting out HTTP_KNOWN_HEADERS(STRING_CONSTANT)
in node::http2::Initialize
.)
Refs: https://github.com/nodejs/node/pull/18020 Fixes: https://github.com/nodejs/node/issues/18047
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
perf_hooks, src