summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-11-21 12:39:55 +0100
committerAnna Henningsen <anna@addaleax.net>2017-11-27 02:00:46 +0100
commit10d86d2284b6891438ecd2402400151714832e0b (patch)
tree8b4eab6e2cbf4a0c75d5d6ad08a74c7b4fd7ac47 /src
parent7306a337f6d32cedfbd002484e0b0e8a47f5ad09 (diff)
downloadandroid-node-v8-10d86d2284b6891438ecd2402400151714832e0b.tar.gz
android-node-v8-10d86d2284b6891438ecd2402400151714832e0b.tar.bz2
android-node-v8-10d86d2284b6891438ecd2402400151714832e0b.zip
http2: don't call into JS from GC
Calling into JS land from GC is not allowed, so delay the resolution of pending pings when a session is destroyed. PR-URL: https://github.com/nodejs/node/pull/17183 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Diffstat (limited to 'src')
-rw-r--r--src/node_http2.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/node_http2.cc b/src/node_http2.cc
index b439ae588a..52883dcd64 100644
--- a/src/node_http2.cc
+++ b/src/node_http2.cc
@@ -406,7 +406,11 @@ void Http2Session::Close() {
while (!outstanding_pings_.empty()) {
Http2Session::Http2Ping* ping = PopPing();
- ping->Done(false);
+ // Since this method may be called from GC, calling into JS directly
+ // is not allowed.
+ env()->SetImmediate([](Environment* env, void* data) {
+ static_cast<Http2Session::Http2Ping*>(data)->Done(false);
+ }, static_cast<void*>(ping));
}
Stop();