[vm] Start logging if shutdown takes too long.
Change-Id: I2280df660cfeefe600ed7d0323769efc84ba54e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99738
Reviewed-by: Chinmay Garde <chinmaygarde@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index ffb115e..822cab8 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -379,8 +379,21 @@
void Dart::WaitForApplicationIsolateShutdown() {
ASSERT(!Isolate::creation_enabled_);
MonitorLocker ml(Isolate::isolates_list_monitor_);
+ intptr_t num_attempts = 0;
while (HasApplicationIsolateLocked()) {
- ml.Wait();
+ Monitor::WaitResult retval = ml.Wait(1000);
+ if (retval == Monitor::kTimedOut) {
+ num_attempts += 1;
+ if (num_attempts > 10) {
+ for (Isolate* isolate = Isolate::isolates_list_head_; isolate != NULL;
+ isolate = isolate->next_) {
+ if (!Isolate::IsVMInternalIsolate(isolate)) {
+ OS::PrintErr("Attempt:%" Pd " waiting for isolate %s to check in\n",
+ num_attempts, isolate->name_);
+ }
+ }
+ }
+ }
}
}
@@ -388,9 +401,19 @@
void Dart::WaitForIsolateShutdown() {
ASSERT(!Isolate::creation_enabled_);
MonitorLocker ml(Isolate::isolates_list_monitor_);
+ intptr_t num_attempts = 0;
while ((Isolate::isolates_list_head_ != NULL) &&
(Isolate::isolates_list_head_->next_ != NULL)) {
- ml.Wait();
+ Monitor::WaitResult retval = ml.Wait(1000);
+ if (retval == Monitor::kTimedOut) {
+ num_attempts += 1;
+ if (num_attempts > 10) {
+ for (Isolate* isolate = Isolate::isolates_list_head_; isolate != NULL;
+ isolate = isolate->next_)
+ OS::PrintErr("Attempt:%" Pd " waiting for isolate %s to check in\n",
+ num_attempts, isolate->name_);
+ }
+ }
}
ASSERT(Isolate::isolates_list_head_ == Dart::vm_isolate());
}