diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-07-21 00:12:41 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-07-23 02:41:22 +0300 |
commit | 9949fbda469e70acc45975f5e50eedd2a3cde57d (patch) | |
tree | abdf778a51515a387c1b6ba6087017dc103e6fa3 /src/base_object.h | |
parent | 89e4b36e62978f54b2e33b4bce8197072dbe8af1 (diff) |
src: do not include partial AsyncWrap instances in heap dump
Heap dumps can be taken either through the inspector or the public API
for it during an async_hooks init() hook, but at that point the
AsyncWrap in question is not done initializing yet and virtual methods
cannot be called on it.
Address this issue (somewhat hackily) by excluding `AsyncWrap`
instances which have not yet executed their `init()` hook fully
from heap dumps.
Fixes: https://github.com/nodejs/node/issues/28786
PR-URL: https://github.com/nodejs/node/pull/28789
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/base_object.h')
-rw-r--r-- | src/base_object.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/base_object.h b/src/base_object.h index 53bd4b00d60..0b202cd3a51 100644 --- a/src/base_object.h +++ b/src/base_object.h @@ -83,6 +83,9 @@ class BaseObject : public MemoryRetainer { v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info); + // This is a bit of a hack. See the override in async_wrap.cc for details. + virtual bool IsDoneInitializing() const; + protected: // Can be used to avoid the automatic object deletion when the Environment // exits, for example when this object is owned and deleted by another |