diff --git a/runtime/tests/vm/dart/isolates/many_debug_name_test.dart b/runtime/tests/vm/dart/isolates/many_debug_name_test.dart new file mode 100644 index 00000000000..ad737f43ca3 --- /dev/null +++ b/runtime/tests/vm/dart/isolates/many_debug_name_test.dart @@ -0,0 +1,24 @@ +// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:isolate'; + +child(replyPort) { + for (var i = 0; i < 10; i++) { + replyPort.send(Isolate.current.debugName); + } +} + +main() async { + var pending = 0; + var port = new RawReceivePort(); + port.handler = (_) { + pending--; + if (pending == 0) port.close(); + }; + for (var i = 0; i < 20; i++) { + pending += 10; + Isolate.spawn(child, port.sendPort); + } +} diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc index 86d91f58b82..64e652b25d3 100644 --- a/runtime/vm/isolate.cc +++ b/runtime/vm/isolate.cc @@ -3617,9 +3617,6 @@ void Isolate::PauseEventHandler() { #endif // !defined(PRODUCT) void Isolate::VisitIsolates(IsolateVisitor* visitor) { - if (visitor == nullptr) { - return; - } IsolateGroup::ForEach([&](IsolateGroup* group) { group->ForEachIsolate( [&](Isolate* isolate) { visitor->VisitIsolate(isolate); }); @@ -3635,7 +3632,6 @@ intptr_t Isolate::IsolateListLength() { } std::unique_ptr Isolate::LookupIsolateNameByPort(Dart_Port port) { - MonitorLocker ml(isolate_creation_monitor_); std::unique_ptr result; IsolateGroup::ForEach([&](IsolateGroup* group) { group->ForEachIsolate([&](Isolate* isolate) {