diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc index ad6966cf4fc13e..d53eaa7329beed 100644 --- a/src/node_main_instance.cc +++ b/src/node_main_instance.cc @@ -102,8 +102,12 @@ NodeMainInstance::~NodeMainInstance() { if (!owns_isolate_) { return; } - platform_->UnregisterIsolate(isolate_); + // TODO(addaleax): Reverse the order of these calls. The fact that we first + // dispose the Isolate is a temporary workaround for + // https://github.com/nodejs/node/issues/31752 -- V8 should not be posting + // platform tasks during Dispose(), but it does in some WASM edge cases. isolate_->Dispose(); + platform_->UnregisterIsolate(isolate_); } int NodeMainInstance::Run() {