Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[coverage] Fix isolate resumption after service disposal #1189

Merged
merged 2 commits into from
Nov 10, 2024
Merged

Conversation

liamappelbe
Copy link
Contributor

@liamappelbe liamappelbe commented Nov 7, 2024

The sequence of events that reproduces the bug is:

  1. Main isolate starts
  2. Main isolate spawns other isolates
  3. Other isolates pause, are collected, and exit
  4. IsolatePausedListener._allNonMainIsolatesExited is completed, so IsolatePausedListener.waitUntilAllExited starts waiting on IsolatePausedListener._mainIsolatePaused.
  5. Main isolate spawns more isolates
  6. Main isolate pauses
  7. IsolatePausedListener._mainIsolatePaused is completed, so IsolatePausedListener.waitUntilAllExited collects and resumes the main isolate
  8. The main isolate has exited, so the VM shuts down, and the VM service connection is disposed
  9. The remaining isolates pause, so IsolatePausedListener tries to collect and resume them, causing the exception seen in the bug.

Step 5 is the bit I didn't consider when writing the new flow. The fix is just to make _allNonMainIsolatesExited wait for main to pause (logically this future is now _allNonMainIsolatesExitedAndMainIsolatePaused, but that's a bit verbose).

Details:

  • We're already calling _checkCompleted() when main is paused (to fix a different edge case), so we're still going to complete the _allNonMainIsolatesExited future even if all the non-main isolates exit before main pauses.
  • In some sequences (see test), the other isolates in main's group are collected before main, so main's _runCallbackAndResume() call now has to check if main's group has already been collected.

Fixes #685

Copy link

github-actions bot commented Nov 7, 2024

Package publishing

Package Version Status Publish tag (post-merge)
package:coverage 1.11.0 ready to publish coverage-v1.11.0
package:bazel_worker 1.1.3-wip WIP (no publish necessary)
package:benchmark_harness 2.3.1 already published at pub.dev
package:boolean_selector 2.1.2 already published at pub.dev
package:browser_launcher 1.1.3 already published at pub.dev
package:cli_config 0.2.1-wip WIP (no publish necessary)
package:cli_util 0.4.2 already published at pub.dev
package:clock 1.1.2 already published at pub.dev
package:code_builder 4.10.1 already published at pub.dev
package:csslib 1.0.2 already published at pub.dev
package:extension_discovery 2.1.0 already published at pub.dev
package:file 7.0.1 already published at pub.dev
package:file_testing 3.0.2 already published at pub.dev
package:graphs 2.3.3-wip WIP (no publish necessary)
package:html 0.15.5 already published at pub.dev
package:json_rpc_2 3.0.3 already published at pub.dev
package:mime 2.0.0 already published at pub.dev
package:oauth2 2.0.4-wip WIP (no publish necessary)
package:source_map_stack_trace 2.1.3-wip WIP (no publish necessary)
package:unified_analytics 6.1.4 already published at pub.dev

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

Copy link

github-actions bot commented Nov 7, 2024

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
coverage None 1.10.0 1.11.0 1.10.0 ✔️
Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

Coverage ✔️
File Coverage
pkgs/coverage/lib/src/isolate_paused_listener.dart 💚 98 %

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.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2024, 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.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/bazel_worker/benchmark/benchmark.dart
pkgs/bazel_worker/example/client.dart
pkgs/bazel_worker/example/worker.dart
pkgs/bazel_worker/lib/src/worker_protocol.pb.dart
pkgs/benchmark_harness/integration_test/perf_benchmark_test.dart
pkgs/boolean_selector/example/example.dart
pkgs/clock/lib/clock.dart
pkgs/clock/lib/src/clock.dart
pkgs/clock/lib/src/default.dart
pkgs/clock/lib/src/stopwatch.dart
pkgs/clock/lib/src/utils.dart
pkgs/clock/test/clock_test.dart
pkgs/clock/test/default_test.dart
pkgs/clock/test/stopwatch_test.dart
pkgs/clock/test/utils.dart
pkgs/html/example/main.dart
pkgs/html/lib/dom.dart
pkgs/html/lib/dom_parsing.dart
pkgs/html/lib/html_escape.dart
pkgs/html/lib/parser.dart
pkgs/html/lib/src/constants.dart
pkgs/html/lib/src/encoding_parser.dart
pkgs/html/lib/src/html_input_stream.dart
pkgs/html/lib/src/list_proxy.dart
pkgs/html/lib/src/query_selector.dart
pkgs/html/lib/src/token.dart
pkgs/html/lib/src/tokenizer.dart
pkgs/html/lib/src/treebuilder.dart
pkgs/html/lib/src/utils.dart
pkgs/html/test/dom_test.dart
pkgs/html/test/parser_feature_test.dart
pkgs/html/test/parser_test.dart
pkgs/html/test/query_selector_test.dart
pkgs/html/test/selectors/level1_baseline_test.dart
pkgs/html/test/selectors/level1_lib.dart
pkgs/html/test/selectors/selectors.dart
pkgs/html/test/support.dart
pkgs/html/test/tokenizer_test.dart

@coveralls
Copy link

coveralls commented Nov 7, 2024

Pull Request Test Coverage Report for Build 11716029981

Details

  • 7 of 7 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 93.037%

Totals Coverage Status
Change from base Build 11670808043: 0.05%
Covered Lines: 628
Relevant Lines: 675

💛 - Coveralls

@liamappelbe liamappelbe merged commit a6603a4 into main Nov 10, 2024
18 checks passed
@liamappelbe liamappelbe deleted the fix685 branch November 10, 2024 22:13
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Nov 14, 2024
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/24c2a96..6bbd3d7):
  6bbd3d7b  2024-11-14  Sam Rawlins  Do not use SpecialClass to evaluate Enum or Interceptor (dart-lang/dartdoc#3928)
  dcc239a4  2024-11-12  Sam Rawlins  Refactor special case for how canonical enclosing containers are calculated (dart-lang/dartdoc#3925)
  80032309  2024-11-11  Sam Rawlins  Ignore static issue with overridden field (dart-lang/dartdoc#3926)

http (https://github.com/dart-lang/http/compare/03ced4d..2f954e1):
  2f954e1  2024-11-11  Brian Quinlan  Add macOS tests for `package:cupertino_http` (dart-lang/http#1403)

shelf (https://github.com/dart-lang/shelf/compare/1a141c7..0bb44cb):
  0bb44cb  2024-11-12  Devon Carew  add direct links to the package issues (dart-lang/shelf#455)

tools (https://github.com/dart-lang/tools/compare/66afa68..a6603a4):
  a6603a45  2024-11-11  Liam Appelbe  [coverage] Fix isolate resumption after service disposal (dart-lang/tools#1189)

Change-Id: I715f943ff69ae24b5126a7ddf883d31aed180632
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395402
Reviewed-by: Konstantin Shcheglov <[email protected]>
Auto-Submit: Devon Carew <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[coverage] VmService exception at exit on github CI
3 participants