Repository navigation
[tool] Defer app.restart until the app has finished starting - #192650
Merged
Merged
Conversation
flutter-zl
marked this pull request as ready for review
September 11, 2026 20:52
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the daemon command to defer app.restart requests until the application has finished starting up, preventing potential compiler issues. It also introduces structured error handling for startup failures using a dedicated completer on AppInstance and adds comprehensive tests for these scenarios. The review feedback suggests capturing and forwarding the original StackTrace when catching startup errors to preserve debugging information.
# Conflicts: # packages/flutter_tools/lib/src/commands/daemon.dart
bkonyi
approved these changes
Sep 15, 2026
bkonyi
left a comment
Contributor
There was a problem hiding this comment.
This LGTM once the dashboard goes green (the failures seem to be unrelated to your change).
This was referenced Sep 16, 2026
auto-submit Bot
pushed a commit
to flutter/packages
that referenced
this pull request
Sep 17, 2026
…12890) Manual roll requested by [email protected] flutter/flutter@27fec0e...8737f11 2026-09-15 [email protected] [flutter_tools] Migrate BuildBundleCommand to modular dependency injection (flutter/flutter#192462) 2026-09-15 [email protected] Migrate SDK constraints for record_use and data_asset integration test packages to ^3.13.0-0 (flutter/flutter#192728) 2026-09-15 [email protected] [tool] Defer app.restart until the app has finished starting (flutter/flutter#192650) 2026-09-15 [email protected] Suggest the -d flag after interactive device selection (flutter/flutter#188941) 2026-09-15 [email protected] Roll Packages from 9caa77c to bebbb57 (9 revisions) (flutter/flutter#192809) 2026-09-15 [email protected] Add a compiler warning for fragment shaders containing both texture samplers and early returns. (flutter/flutter#191969) 2026-09-15 [email protected] feat(flutter_tools): migrate Android build commands to typed options (flutter/flutter#192524) 2026-09-15 [email protected] Roll Fuchsia Linux SDK from 7R1l5MhSZZUr1Q6D1... to XCxrICzX1DWvyfqhA... (flutter/flutter#192789) 2026-09-15 [email protected] Roll Dart SDK from 7253dff72c96 to c870e8afe036 (1 revision) (flutter/flutter#192791) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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.
Fixes #192227
Problem
AppDomain.launchsends theapp.startevent, which carries the app ID, beforeResidentRunner.run()has compiled and calledgenerator.accept(). A client that acts on that ID immediately can land anapp.restartin the gap, producing arecompileagainst a compiler with no accepted baseline.frontend_serverthen crashes onlastKnownGoodResult!, and the app fails to start.Fix
AppDomain.restartnow waits on a newAppInstance.startedbefore entering the debounce queue, so the compiler is never asked to recompile before it has a baseline.Demo
No URLs: the bug is in the
flutter run --machinedaemon protocol, not in rendered output, so a deployed build has no daemon to race.Verified locally with a harness that sends
app.restartduring the initial compile, which is the window this closes. Before, it reproduces the exact trace from the issue and the appdies:
After, the restart is held until
app.startedand returnscode: 0.