Skip to content

Commit 8325fa5

Browse files
Qardtargos
authored andcommitted
worker: fix crash when a worker joins after exit
If a worker has not already joined before running to completion it will join in a SetImmediateThreadsafe which could occur after the worker has already ended by other means. Mutating a JS object at that point would fail because the isolate is already disposed. PR-URL: #56191 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
1 parent b0ebd23 commit 8325fa5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/node_worker.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,9 @@ void Worker::JoinThread() {
449449

450450
env()->remove_sub_worker_context(this);
451451

452+
// Join may happen after the worker exits and disposes the isolate
453+
if (!env()->can_call_into_js()) return;
454+
452455
{
453456
HandleScope handle_scope(env()->isolate());
454457
Context::Scope context_scope(env()->context());

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy