Content-Length: 259191 | pFad | https://github.com/nodejs/node/commit/8325fa5c04

E0 worker: fix crash when a worker joins after exit · nodejs/node@8325fa5 · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/nodejs/node/commit/8325fa5c04

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy