[vm] If isolate group spawning fails, we need to enter the IG in order to delete the api state

Fixes https://github.com/dart-lang/sdk/issues/47087

TEST=Fixes vm/dart_2/spawn_shutdown_test/1 test failure.

Change-Id: I416c4732d71eed9fe6fb26b8a5ce12ed5b122d4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212584
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
Martin Kustermann
2021-09-07 14:08:32 +00:00
committed by commit-bot@chromium.org
parent e161187728
commit 258487cafd
+7 -3
View File
@@ -655,7 +655,7 @@ class SpawnIsolateTask : public ThreadPool::Task {
parent_isolate_ = nullptr;
if (isolate == nullptr) {
FailedSpawn(error);
FailedSpawn(error, /*has_current_isolate=*/false);
free(error);
return;
}
@@ -681,7 +681,7 @@ class SpawnIsolateTask : public ThreadPool::Task {
parent_isolate_ = nullptr;
if (isolate == nullptr) {
FailedSpawn(error, false);
FailedSpawn(error, /*has_current_isolate=*/false);
free(error);
return;
}
@@ -854,7 +854,7 @@ class SpawnIsolateTask : public ThreadPool::Task {
if (has_current_isolate) {
ASSERT(IsolateGroup::Current() == state_->isolate_group());
state_ = nullptr;
} else {
} else if (state_->isolate_group() != nullptr) {
ASSERT(IsolateGroup::Current() == nullptr);
const bool kBypassSafepoint = false;
const bool result = Thread::EnterIsolateGroupAsHelper(
@@ -862,6 +862,10 @@ class SpawnIsolateTask : public ThreadPool::Task {
ASSERT(result);
state_ = nullptr;
Thread::ExitIsolateGroupAsHelper(kBypassSafepoint);
} else {
// The state won't need a current isolate group, because it belongs to a
// [Isolate.spawnUri] call.
state_ = nullptr;
}
}