Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Unified Diff: runtime/vm/thread.cc

Issue 1275353005: VM thread shutdown. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/thread.cc
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
index 3b3eb3308d30b292147168449f670ba1f62033f5..b1fd5765bb9b3afa5ebc240bef026f331c5ae23d 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -134,11 +134,15 @@ void Thread::EnterIsolate(Isolate* isolate) {
ASSERT(thread->thread_state() == NULL);
InterruptableThreadState* thread_state =
ThreadInterrupter::GetCurrentThreadState();
-#if defined(DEBUG)
- thread->set_thread_state(NULL); // Exclude thread itself from the dupe check.
- Isolate::CheckForDuplicateThreadState(thread_state);
- thread->set_thread_state(thread_state);
-#endif
+ // TODO(koda): Calling Isolate::CheckForDuplicateThreadState(thread_state)
+ // here can lead to deadlock. Isolate::KillAllIsolates(), takes the isolate
+ // list lock and posts the kill message to the target isolate, entering the
+ // monitor at the top of MessageHandler::PostMessage() to do so. That monitor
+ // is also entered before calling MessageHandler::HandleMessages(), which
+ // enters a StartIsolateScope, which calls Thread::EnterIsolate(), which would
+ // call Isolate::CheckForDuplicateThreadState(), which attempts to take the
+ // isolate list lock, potentially creating a cycle.
+ // Evaluate doing this check some other way.
ASSERT(thread_state != NULL);
// TODO(koda): Migrate profiler interface to use Thread.
Profiler::BeginExecution(isolate);

Powered by Google App Engine
This is Rietveld 408576698