Skip to content

Commit 10bdd5e

Browse files
committed
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.
1 parent 9cd9f43 commit 10bdd5e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/node_worker.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,12 @@ void Worker::JoinThread() {
453453
HandleScope handle_scope(env()->isolate());
454454
Context::Scope context_scope(env()->context());
455455

456+
// TODO(qard): Do we need to move this, or can we just drop it entirely?
457+
// See: https://github.com/nodejs/node/issues/56020
456458
// Reset the parent port as we're closing it now anyway.
457-
object()->Set(env()->context(),
458-
env()->message_port_string(),
459-
Undefined(env()->isolate())).Check();
459+
// object()->Set(env()->context(),
460+
// env()->message_port_string(),
461+
// Undefined(env()->isolate())).Check();
460462

461463
Local<Value> args[] = {
462464
Integer::New(env()->isolate(), static_cast<int>(exit_code_)),

0 commit comments

Comments
 (0)