Skip to content

Commit d130184

Browse files
committed
Revert "src: unregister Isolate with platform before disposing"
This reverts commit 65e5a8a. PR-URL: #31782 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent f0b2d87 commit d130184

File tree

4 files changed

+3
-9
lines changed

4 files changed

+3
-9
lines changed

src/node.h

-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
280280

281281
// This function may only be called once per `Isolate`, and discard any
282282
// pending delayed tasks scheduled for that isolate.
283-
// This needs to be called right before calling `Isolate::Dispose()`.
284283
virtual void UnregisterIsolate(v8::Isolate* isolate) = 0;
285284

286285
// The platform should call the passed function once all state associated

src/node_main_instance.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ NodeMainInstance::~NodeMainInstance() {
9999
if (!owns_isolate_) {
100100
return;
101101
}
102-
platform_->UnregisterIsolate(isolate_);
103102
isolate_->Dispose();
103+
platform_->UnregisterIsolate(isolate_);
104104
}
105105

106106
int NodeMainInstance::Run() {

src/node_worker.cc

+1-6
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,8 @@ class WorkerThreadData {
192192
*static_cast<bool*>(data) = true;
193193
}, &platform_finished);
194194

195-
// The order of these calls is important; if the Isolate is first disposed
196-
// and then unregistered, there is a race condition window in which no
197-
// new Isolate at the same address can successfully be registered with
198-
// the platform.
199-
// (Refs: https://github.com/nodejs/node/issues/30846)
200-
w_->platform_->UnregisterIsolate(isolate);
201195
isolate->Dispose();
196+
w_->platform_->UnregisterIsolate(isolate);
202197

203198
// Wait until the platform has cleaned up all relevant resources.
204199
while (!platform_finished)

test/cctest/node_test_fixture.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ class NodeTestFixture : public ::testing::Test {
106106

107107
void TearDown() override {
108108
isolate_->Exit();
109+
isolate_->Dispose();
109110
platform->DrainTasks(isolate_);
110111
platform->UnregisterIsolate(isolate_);
111-
isolate_->Dispose();
112112
isolate_ = nullptr;
113113
}
114114
};

0 commit comments

Comments
 (0)