[coverage] Finish collection as soon as main isolate exits#2069
Merged
Conversation
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
PR HealthBreaking changes ✔️
Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. Coverage ✔️
This check for test coverage is informational (issues shown here will not fail the PR). API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
|
bkonyi
approved these changes
Apr 9, 2025
copybara-service Bot
pushed a commit
to dart-lang/sdk
that referenced
this pull request
Apr 16, 2025
Revisions updated by `dart tools/rev_sdk_deps.dart`. ecosystem (https://github.com/dart-lang/ecosystem/compare/7f6f1c1..815d4ba): 815d4ba 2025-04-15 Devon Carew [firehose] don't fail publish validation if we see the pub pre-release warning (dart-lang/ecosystem#357) e7bae16 2025-04-15 Moritz Fix label fetching (dart-lang/ecosystem#358) 7aa1313 2025-04-15 Moritz Fix PR label fetching (dart-lang/ecosystem#356) test (https://github.com/dart-lang/test/compare/8643fbf..84eba11): 84eba115 2025-04-11 Daco Harkes [native assets] Add support for pub workspaces (dart-lang/test#2484) ab850972 2025-04-11 Daco Harkes [native assets] Add support for pub workspaces 9f9fd77d 2025-04-10 Nate Bosch Migrate host.dart to new JS interop (dart-lang/test#2448) tools (https://github.com/dart-lang/tools/compare/d74f9e1..4a28415): 4a284152 2025-04-15 Moritz [package:code_builder] Remove transitive dependency on package:macros (dart-lang/tools#2073) 2bb6eba7 2025-04-11 Lasse R.H. Nielsen Simplifies the format for client IDs. (dart-lang/tools#2072) 77e41774 2025-04-10 Liam Appelbe [coverage] Prepare to publish (dart-lang/tools#2070) e7168ae1 2025-04-10 Liam Appelbe [coverage] Finish collection as soon as main isolate exits (dart-lang/tools#2069) vector_math (https://github.com/google/vector_math.dart/compare/f08d7d2..dc9d379): dc9d379 2025-04-15 Lukas Klingsbo chore: Remove test_all.dart since this is built-in to `dart test` (google/vector_math.dart#343) webdev (https://github.com/dart-lang/webdev/compare/c8b1cfa..5bf833d): 5bf833d0 2025-04-15 Srujan Gaddam Support hot reload testing (dart-lang/webdev#2611) fa0b74bf 2025-04-14 Srujan Gaddam Add support for hot restart tests in DWDS with the frontend server (dart-lang/webdev#2608) Change-Id: Ic3ff6ed88ee2db935dc48fafe1e16a869d73506c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422580 Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com> Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In ordinary Dart programs, the VM exits as soon as the main isolate exits. This effectively kills any remaining isolates without waiting for them to shut down.
The package:coverage's usual mode is to wait for isolates to pause before exiting, then collect their coverage, then resume them and allow them to exit. The existing coverage collection flow waited for all isolates to pause/exit before allowing the main isolate to exit, ensuring that complete coverage data was gathered for all isolates.
However, some packages have a pattern where they start a helper isolate, leave it running in the background, and never shut it down. Gathering coverage on a package like that leads to a bug where coverage collection never completes.
To fix this, I changed the flow so that as soon as the main isolate enters the paused-at-exit state, coverage is collected for all remaining isolates, and then the main isolate is allowed to exit.
Detail: Coverage info is shared between all isolates in an isolate group, so we actually gather coverage per-group. So when we're gathering coverage for all remaining isolate groups, we simply pick an arbitrary isolate from that group.
Fixes #2049