mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
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. Backport-PR-URL: https://github.com/nodejs/node/pull/18050 Backport-PR-URL: https://github.com/nodejs/node/pull/20456 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>
This commit is contained in:
1 parent
2b7732788a
commit
38cfb707bd
1 file changed
+5
-1
+5
-1
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user