Commit 5ae6ca08 authored by Shu-yu Guo's avatar Shu-yu Guo Committed by V8 LUCI CQ

Fix parking of outer Isolate during snapshot stress

Turns out parking the outer Isolate needs to encompass the entire
lifetime of the inner Isolate during snapshot stress. Isolate
initialization locks the shared Isolate's client mutex to prevent shared
GCs. This mutex is also taken on Heap teardown on Isolate shutdown
during the shared heap verification, which may end up waiting in a
safepoint, causing deadlock.

Bug: v8:13217
Change-Id: I3893ae883ab345a9d36c9437ea15e90f18951057
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3843288Reviewed-by: 's avatarJakob Linke <jgruber@chromium.org>
Commit-Queue: Jakob Linke <jgruber@chromium.org>
Auto-Submit: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82607}
parent 698c7643
......@@ -324,6 +324,11 @@ void Snapshot::SerializeDeserializeAndVerifyForTesting(
auto_delete_serialized_data.reset(serialized_data.data);
}
// The shared heap is verified on Heap teardown, which performs a global
// safepoint. Both isolate and new_isolate are running in the same thread, so
// park isolate before running new_isolate to avoid deadlock.
ParkedScope parked(isolate->main_thread_local_isolate());
// Test deserialization.
Isolate* new_isolate = Isolate::New();
{
......@@ -350,10 +355,6 @@ void Snapshot::SerializeDeserializeAndVerifyForTesting(
#endif // VERIFY_HEAP
}
new_isolate->Exit();
// The shared heap is verified on Heap teardown, which performs a global
// safepoint. Both isolate and new_isolate are running in the same thread, so
// park isolate before deleting new_isolate to avoid deadlock.
ParkedScope parked(isolate->main_thread_local_isolate());
Isolate::Delete(new_isolate);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment