Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/env.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-11-26 19:09:27 +0300
committerAnna Henningsen <anna@addaleax.net>2019-11-30 05:57:24 +0300
commit6c249c0982b0a5bb1ee3a9cc86c88dde55dfc887 (patch)
treed1cbb13990292b560d2b00eec6d24ee9ee2bfa5c /src/env.h
parentbea25016d12ee9a672b02d5f10b1f0a28dbe400d (diff)
src: run native immediates during Environment cleanup
This can be necessary, because some parts of the Node.js code base perform cleanup operations in the Immediate callbacks, e.g. HTTP/2. This resolves flakiness in an HTTP/2 test that failed when a `SetImmediate()` callback was not run or destroyed before the `Environment` destructor started, because that callback held a strong reference to the `Http2Session` object and the expectation was that no such objects exist once the `Environment` constructor starts. Another, slightly more direct, alternative would have been to clear the immediate queue rather than to run it. However, this approach seems to make more sense as code generally assumes that the `SetImmediate()` callback will always run; For example, N-API uses an immediate callback to call buffer finalization callbacks. Unref’ed immediates are skipped, as the expectation is generally that they may not run anyway. Fixes: https://github.com/nodejs/node/issues/30643 PR-URL: https://github.com/nodejs/node/pull/30666 Refs: https://github.com/nodejs/node/pull/30374 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/env.h')
-rw-r--r--src/env.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/env.h b/src/env.h
index 027f5c0bacf..c0c8ac0db48 100644
--- a/src/env.h
+++ b/src/env.h
@@ -1417,7 +1417,7 @@ class Environment : public MemoryRetainer {
std::unique_ptr<NativeImmediateCallback> native_immediate_callbacks_head_;
NativeImmediateCallback* native_immediate_callbacks_tail_ = nullptr;
- void RunAndClearNativeImmediates();
+ void RunAndClearNativeImmediates(bool only_refed = false);
static void CheckImmediate(uv_check_t* handle);
// Use an unordered_set, so that we have efficient insertion and removal.