Skip to content

Commit 50f367b

Browse files
liamappelbeCommit Queue
authored andcommitted
[vm] Early-out in NativeCallable trampoline if isolate creation disabled
I haven't been able to get a solid repro the tsan flake locally, and I'm not sure how to write a test for it, but this change is pretty uncontroversial anyway, so I'm inclined to just land it and see what happens. I have some weak evidence that this fixes the issue though. Before this change I ran the flaky command about 500 times before I saw a failure (though I didn't get any useful data from the failure, and it didn't look quite the same as the bug). With the change, the command ran 3500 times before flaking. I'm not sure if it's the same flake though (rr isn't working for me atm). Bug: #56900 Fixes: #56900 Change-Id: I939e8ceca4051ec91e942ca38a2b01477b67ddd8 TEST=CI Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392162 Reviewed-by: Ryan Macnak <[email protected]> Commit-Queue: Liam Appelbe <[email protected]>
1 parent 3cd0771 commit 50f367b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

runtime/vm/isolate.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ Isolate* IsolateGroup::EnterTemporaryIsolate() {
863863
Dart_IsolateFlags flags;
864864
Isolate::FlagsInitialize(&flags);
865865
Isolate* const isolate = Isolate::InitIsolate("temp", this, flags);
866-
ASSERT(isolate != nullptr);
866+
RELEASE_ASSERT(isolate != nullptr);
867867
ASSERT(Isolate::Current() == isolate);
868868
return isolate;
869869
}

runtime/vm/runtime_entry.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4378,6 +4378,12 @@ extern "C" Thread* DLRT_GetFfiCallbackMetadata(
43784378
ASSERT(out_entry_point != nullptr);
43794379
ASSERT(out_trampoline_type != nullptr);
43804380

4381+
if (!Isolate::IsolateCreationEnabled()) {
4382+
TRACE_RUNTIME_CALL("GetFfiCallbackMetadata called after shutdown %p",
4383+
reinterpret_cast<void*>(trampoline));
4384+
return nullptr;
4385+
}
4386+
43814387
Thread* const current_thread = Thread::Current();
43824388
auto* fcm = FfiCallbackMetadata::Instance();
43834389
auto metadata = fcm->LookupMetadataForTrampoline(trampoline);

0 commit comments

Comments
 (0)