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

During hot-restart, wait to run main when pause_isolates_on_start is true #2378

Merged
merged 9 commits into from
Mar 5, 2024

Conversation

elliette
Copy link
Contributor

@elliette elliette commented Feb 29, 2024

During a hot-restart, if pause_isolates_on_start is true, DWDS waits for a call to resume before running the app's main method. This gives the debugging client time to re-set any breakpoints before the app is run.

When using RequireStrategy (flutter, webdev):

  • dwds/web/reloader/require_restarter.dart waits for the readyToRunMain future before calling the main method

When using DdcStrategy (g3):

  • The readyToRunMain future is converted to a promise and passed to pkg/dev_compiler/lib/js/ddc/ddc_module_loader.js (externally, different script internally), which then waits for it to resolve before calling the main method
  • Note: requires https://dart-review.googlesource.com/c/sdk/+/355880 - question: is this script used in any configuration?

Work towards flutter/devtools#7231

@elliette elliette changed the title [Draft] Tell DDC to wait for a resume event to run main After hot-restart, DDC waits for a resume event to run main Mar 4, 2024
@elliette elliette changed the title After hot-restart, DDC waits for a resume event to run main Tell DDC to wait to run main when pause_isolates_on_start is true Mar 4, 2024
@elliette elliette changed the title Tell DDC to wait to run main when pause_isolates_on_start is true Tell DDC to wait to run main when pause_isolates_on_start is true (webdev, g3) Mar 4, 2024
@elliette elliette changed the title Tell DDC to wait to run main when pause_isolates_on_start is true (webdev, g3) Tell DDC to wait to run main when pause_isolates_on_start is true Mar 5, 2024
@elliette elliette changed the title Tell DDC to wait to run main when pause_isolates_on_start is true Wait to run main when pause_isolates_on_start is true Mar 5, 2024
@elliette elliette requested review from Markzipan and nshahan March 5, 2024 18:17
@elliette elliette changed the title Wait to run main when pause_isolates_on_start is true During hot-restart, wait to run main when pause_isolates_on_start is true Mar 5, 2024
@nshahan
Copy link
Contributor

nshahan commented Mar 5, 2024

Note: requires https://dart-review.googlesource.com/c/sdk/+/355880 - question: is this script used in any configuration?

Currently it is used by the expression compiler tests on the ddc test configurations in the SDK and it is also used by the benchmarking infra when running code with DDC. There is a very minor test in the SDK that runs on the benchmark-linux config that ensures we don't totally break the pieces the benchmark infra relies on.

We will be adding more configs and tests in the near future though.

Copy link
Contributor

@nshahan nshahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again work walking me through these changes. LGTM but we will need to revisit in the future to reduce the size of the window between clearing breakpoints and resetting them when were ready to support a stateful hot reload.

@elliette elliette merged commit a8789f3 into dart-lang:master Mar 5, 2024
47 checks passed
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.

2 participants