Branch: refs/heads/main
Home:
https://github.com/dart-lang/sdk
Commit: d5413c8d6bdf5c9c991fb052def0a2ff4f6e8602
https://github.com/dart-lang/sdk/commit/d5413c8d6bdf5c9c991fb052def0a2ff4f6e8602
Author: Ben Konyi <
bko...@google.com>
Date: 2026-06-18 (Thu, 18 Jun 2026)
Changed paths:
M pkg/vm_service/test/common/service_test_common.dart
Log Message:
-----------
[vm_service] Fix race condition in resumeIsolate
Apply the asynchronous and synchronous-nullification pattern to `resumeIsolate` to resolve a race condition.
Previously, because the debug stream listener didn't check if it was completing the same `Completer` multiple times, multiple incoming `kResume` events (or concurrent paths) could double-complete it and throw a `StateError`.
By introducing a synchronous helper `complete` which nullifies the `completer` variable synchronously BEFORE yielding to any asynchronous calls (like `subscription.cancel()` or `streamCancel()`), we guarantee that only one execution path can successfully complete the completer, preventing concurrent double-completing races. Additionally, we verify the isolate ID of the event matches the isolate being resumed.
Change-Id: If170ed425b6123de9255cdd1b794f176bac73dc3
Reviewed-on:
https://dart-review.googlesource.com/c/sdk/+/508380
Reviewed-by: Nicholas Shahan <
nsh...@google.com>
Commit-Queue: Ben Konyi <
bko...@google.com>
Auto-Submit: Ben Konyi <
bko...@google.com>
To unsubscribe from these emails, change your notification settings at
https://github.com/dart-lang/sdk/settings/notifications