summaryrefslogtreecommitdiff
path: root/src/async_wrap.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-07-20 23:12:41 +0200
committerRich Trott <rtrott@gmail.com>2019-07-22 16:41:22 -0700
commit9949fbda469e70acc45975f5e50eedd2a3cde57d (patch)
treeabdf778a51515a387c1b6ba6087017dc103e6fa3 /src/async_wrap.h
parent89e4b36e62978f54b2e33b4bce8197072dbe8af1 (diff)
downloadandroid-node-v8-9949fbda469e70acc45975f5e50eedd2a3cde57d.tar.gz
android-node-v8-9949fbda469e70acc45975f5e50eedd2a3cde57d.tar.bz2
android-node-v8-9949fbda469e70acc45975f5e50eedd2a3cde57d.zip
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/async_wrap.h')
-rw-r--r--src/async_wrap.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/async_wrap.h b/src/async_wrap.h
index 0fe4135223..546f5130e0 100644
--- a/src/async_wrap.h
+++ b/src/async_wrap.h
@@ -210,6 +210,8 @@ class AsyncWrap : public BaseObject {
AsyncWrap* wrap_ = nullptr;
};
+ bool IsDoneInitializing() const override;
+
private:
friend class PromiseWrap;
@@ -218,7 +220,8 @@ class AsyncWrap : public BaseObject {
ProviderType provider,
double execution_async_id,
bool silent);
- ProviderType provider_type_;
+ ProviderType provider_type_ = PROVIDER_NONE;
+ bool init_hook_ran_ = false;
// Because the values may be Reset(), cannot be made const.
double async_id_ = kInvalidAsyncId;
double trigger_async_id_;