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

Stuck on "Flutter: Hot restarting..." #4980

Open
simplenotezy opened this issue Feb 10, 2024 · 3 comments
Open

Stuck on "Flutter: Hot restarting..." #4980

simplenotezy opened this issue Feb 10, 2024 · 3 comments
Labels
blocked on dart / flutter Requires a change in Dart or Flutter to progress in debugger Relates to the debug adapter or process of launching a debug session in flutter Relates to running Flutter apps is bug
Milestone

Comments

@simplenotezy
Copy link

Steps to reproduce

  • Attempt to start a (larger ?) app in debug mode.
  • Make some code changes
  • Click "Restart" - sometimes a few times

Expected results

It should restart every time without issues

Actual results

It's often stuck in "Flutter: Hot restarting..." when making changes and then restarting.

It happens several times a day, seriously hindering developer productivity - and has done so for at least 12 months - on different (mainly ARM) setups, both to me and colleagues.

Since upgrading from 3.13.1 to 3.16.9 I also started noticing that the debugger is detached from VSCode but still running on the phone as well as in XCode. I also notice that the console logs in vscode remain empty, even on restarts. Restarting the debug session usually make content reappear in console logs.

Related: #4958, flutter/flutter#139651

Code sample

I am willing to share our code-base with a flutter contributer, but apart from that I don't think theres anything concrete I can share to reproduce this issue.

Screenshots or Video

Screenshots / Video demonstration
hot.restarting.mov
image

Logs

It's run through vs code - not sure how I can share the logs

Flutter Doctor output

Doctor output
flutter doctor -vflutter doctor -v
[✓] Flutter (Channel stable, 3.16.9, on macOS 14.1.1 23B81 darwin-arm64, locale en-DK)
    • Flutter version 3.16.9 on channel stable at /Users/mf/fvm/versions/3.16.9
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 41456452f2 (2 weeks ago), 2024-01-25 10:06:23 -0800
    • Engine revision f40e976bed
    • Dart version 3.2.6
    • DevTools version 2.28.5

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/mf/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.13.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.86.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.82.0
@DanTup
Copy link
Member

DanTup commented Feb 13, 2024

Thanks, I was able to repro this.

It seems that overlapped hot restarts don't complete correctly:

// Restart #1
[12:33:18 PM] [DAP] [Info] ==> {"command":"restart","arguments":{"arguments":{"dartCodeDebugSessionID":"session-9008d","type":"dart","request":"launch","program":"C:\\Dev\\Test Projects\\dartcode_4980\\lib\\main.dart","projectRootPath":"C:\\Dev\\Test Projects\\dartcode_4980","cwd":"C:\\Dev\\Test Projects\\dartcode_4980","name":"Flutter (Windows)","deviceId":"windows","deviceName":"Windows (windows-x64)","toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code","FLUTTER_ROOT":"C:\\Dev\\Google\\flutter"},"sendLogsToClient":false,"sendCustomProgressEvents":true,"allowAnsiColorOutput":true,"additionalProjectPaths":["C:\\Dev\\Test Projects\\dartcode_4980"],"args":[],"vmAdditionalArgs":[],"toolArgs":["-d","windows","--devtools-server-address","http://127.0.0.1:9100/"],"vmServicePort":0,"dartSdkPath":"C:\\Dev\\Google\\flutter\\bin\\cache\\dart-sdk","vmServiceLogFile":"C:\\Dev\\Logs\\observatory.flutter_windows_.txt","webDaemonLogFile":"C:\\Dev\\Logs\\web_daemon.flutter_windows_.txt","maxLogLineLength":99999999,"debugSdkLibraries":false,"debugExternalPackageLibraries":false,"showDartDeveloperLogs":true,"evaluateGettersInDebugViews":true,"showGettersInDebugViews":true,"evaluateToStringInDebugViews":true,"flutterSdkPath":"C:\\Dev\\Google\\flutter","useInspectorNotificationsForWidgetErrors":true,"flutterRunLogFile":"C:\\Dev\\Logs\\flutter_run.flutter_windows_.txt","flutterTestLogFile":"C:\\Dev\\Logs\\flutter_test.flutter_windows_.txt","showMemoryUsage":false,"debuggerType":2,"__sessionId":"16366636-2b95-4206-9f63-5d72281075af"}},"type":"request","seq":8}
[12:33:18 PM] [DAP] [Info] <== {"seq":88,"type":"event","body":{"message":"Hot restarting…","progressId":"hotRestart_2","title":"Flutter"},"event":"dart.progressStart"}
[12:33:18 PM] [DAP] [Info] <== {"seq":91,"type":"event","body":{"category":"stdout","output":"Restarted application in 168ms.\n"},"event":"output"}
[12:33:18 PM] [DAP] [Info] <== {"seq":92,"type":"event","body":{"progressId":"hotRestart_2"},"event":"dart.progressEnd"}
[12:33:18 PM] [DAP] [Info] <== {"seq":93,"type":"response","command":"restart","request_seq":8,"success":true}


// Restart 2 + 3 overlap
[12:33:18 PM] [DAP] [Info] ==> {"command":"restart","arguments":{"arguments":{"dartCodeDebugSessionID":"session-9008d","type":"dart","request":"launch","program":"C:\\Dev\\Test Projects\\dartcode_4980\\lib\\main.dart","projectRootPath":"C:\\Dev\\Test Projects\\dartcode_4980","cwd":"C:\\Dev\\Test Projects\\dartcode_4980","name":"Flutter (Windows)","deviceId":"windows","deviceName":"Windows (windows-x64)","toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code","FLUTTER_ROOT":"C:\\Dev\\Google\\flutter"},"sendLogsToClient":false,"sendCustomProgressEvents":true,"allowAnsiColorOutput":true,"additionalProjectPaths":["C:\\Dev\\Test Projects\\dartcode_4980"],"args":[],"vmAdditionalArgs":[],"toolArgs":["-d","windows","--devtools-server-address","http://127.0.0.1:9100/"],"vmServicePort":0,"dartSdkPath":"C:\\Dev\\Google\\flutter\\bin\\cache\\dart-sdk","vmServiceLogFile":"C:\\Dev\\Logs\\observatory.flutter_windows_.txt","webDaemonLogFile":"C:\\Dev\\Logs\\web_daemon.flutter_windows_.txt","maxLogLineLength":99999999,"debugSdkLibraries":false,"debugExternalPackageLibraries":false,"showDartDeveloperLogs":true,"evaluateGettersInDebugViews":true,"showGettersInDebugViews":true,"evaluateToStringInDebugViews":true,"flutterSdkPath":"C:\\Dev\\Google\\flutter","useInspectorNotificationsForWidgetErrors":true,"flutterRunLogFile":"C:\\Dev\\Logs\\flutter_run.flutter_windows_.txt","flutterTestLogFile":"C:\\Dev\\Logs\\flutter_test.flutter_windows_.txt","showMemoryUsage":false,"debuggerType":2,"__sessionId":"16366636-2b95-4206-9f63-5d72281075af"}},"type":"request","seq":10}
[12:33:18 PM] [DAP] [Info] <== {"seq":95,"type":"event","body":{"message":"Hot restarting…","progressId":"hotRestart_3","title":"Flutter"},"event":"dart.progressStart"}
[12:33:19 PM] [DAP] [Info] ==> {"command":"restart","arguments":{"arguments":{"dartCodeDebugSessionID":"session-9008d","type":"dart","request":"launch","program":"C:\\Dev\\Test Projects\\dartcode_4980\\lib\\main.dart","projectRootPath":"C:\\Dev\\Test Projects\\dartcode_4980","cwd":"C:\\Dev\\Test Projects\\dartcode_4980","name":"Flutter (Windows)","deviceId":"windows","deviceName":"Windows (windows-x64)","toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code","FLUTTER_ROOT":"C:\\Dev\\Google\\flutter"},"sendLogsToClient":false,"sendCustomProgressEvents":true,"allowAnsiColorOutput":true,"additionalProjectPaths":["C:\\Dev\\Test Projects\\dartcode_4980"],"args":[],"vmAdditionalArgs":[],"toolArgs":["-d","windows","--devtools-server-address","http://127.0.0.1:9100/"],"vmServicePort":0,"dartSdkPath":"C:\\Dev\\Google\\flutter\\bin\\cache\\dart-sdk","vmServiceLogFile":"C:\\Dev\\Logs\\observatory.flutter_windows_.txt","webDaemonLogFile":"C:\\Dev\\Logs\\web_daemon.flutter_windows_.txt","maxLogLineLength":99999999,"debugSdkLibraries":false,"debugExternalPackageLibraries":false,"showDartDeveloperLogs":true,"evaluateGettersInDebugViews":true,"showGettersInDebugViews":true,"evaluateToStringInDebugViews":true,"flutterSdkPath":"C:\\Dev\\Google\\flutter","useInspectorNotificationsForWidgetErrors":true,"flutterRunLogFile":"C:\\Dev\\Logs\\flutter_run.flutter_windows_.txt","flutterTestLogFile":"C:\\Dev\\Logs\\flutter_test.flutter_windows_.txt","showMemoryUsage":false,"debuggerType":2,"__sessionId":"16366636-2b95-4206-9f63-5d72281075af"}},"type":"request","seq":12}
[12:33:19 PM] [DAP] [Info] <== {"seq":167,"type":"event","body":{"message":"Hot restarting…","progressId":"hotRestart_4","title":"Flutter"},"event":"dart.progressStart"}
[12:33:19 PM] [DAP] [Info] ==> {"command":"restart","arguments":{"arguments":{"dartCodeDebugSessionID":"session-9008d","type":"dart","request":"launch","program":"C:\\Dev\\Test Projects\\dartcode_4980\\lib\\main.dart","projectRootPath":"C:\\Dev\\Test Projects\\dartcode_4980","cwd":"C:\\Dev\\Test Projects\\dartcode_4980","name":"Flutter (Windows)","deviceId":"windows","deviceName":"Windows (windows-x64)","toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code","FLUTTER_ROOT":"C:\\Dev\\Google\\flutter"},"sendLogsToClient":false,"sendCustomProgressEvents":true,"allowAnsiColorOutput":true,"additionalProjectPaths":["C:\\Dev\\Test Projects\\dartcode_4980"],"args":[],"vmAdditionalArgs":[],"toolArgs":["-d","windows","--devtools-server-address","http://127.0.0.1:9100/"],"vmServicePort":0,"dartSdkPath":"C:\\Dev\\Google\\flutter\\bin\\cache\\dart-sdk","vmServiceLogFile":"C:\\Dev\\Logs\\observatory.flutter_windows_.txt","webDaemonLogFile":"C:\\Dev\\Logs\\web_daemon.flutter_windows_.txt","maxLogLineLength":99999999,"debugSdkLibraries":false,"debugExternalPackageLibraries":false,"showDartDeveloperLogs":true,"evaluateGettersInDebugViews":true,"showGettersInDebugViews":true,"evaluateToStringInDebugViews":true,"flutterSdkPath":"C:\\Dev\\Google\\flutter","useInspectorNotificationsForWidgetErrors":true,"flutterRunLogFile":"C:\\Dev\\Logs\\flutter_run.flutter_windows_.txt","flutterTestLogFile":"C:\\Dev\\Logs\\flutter_test.flutter_windows_.txt","showMemoryUsage":false,"debuggerType":2,"__sessionId":"16366636-2b95-4206-9f63-5d72281075af"}},"type":"request","seq":13}
[12:33:19 PM] [DAP] [Info] <== {"seq":168,"type":"event","body":{"message":"Hot restarting…","progressId":"hotRestart_5","title":"Flutter"},"event":"dart.progressStart"}
[12:33:19 PM] [DAP] [Info] <== {"seq":174,"type":"event","body":{"category":"stdout","output":"Restarted application in 306ms.\n"},"event":"output"}

// Only first restart completes
[12:33:19 PM] [DAP] [Info] <== {"seq":175,"type":"event","body":{"progressId":"hotRestart_3"},"event":"dart.progressEnd"}
[12:33:19 PM] [DAP] [Info] <== {"seq":176,"type":"response","command":"restart","request_seq":10,"success":true}

@DanTup DanTup added in flutter Relates to running Flutter apps in debugger Relates to the debug adapter or process of launching a debug session labels Feb 13, 2024
@DanTup DanTup added this to the v3.84.0 milestone Feb 13, 2024
@DanTup
Copy link
Member

DanTup commented Feb 13, 2024

I think the issue here is occurring in Flutter. I've written up some notes at flutter/flutter#143371 and will continue to investigate.

@simplenotezy
Copy link
Author

Well spotted; thanks @DanTup - let us know if we can help debug in any way.

@DanTup DanTup modified the milestones: v3.84.0, v3.86.0 Feb 15, 2024
@DanTup DanTup added the blocked on dart / flutter Requires a change in Dart or Flutter to progress label Feb 15, 2024
@DanTup DanTup modified the milestones: v3.86.0, v3.88.0 Apr 2, 2024
@DanTup DanTup modified the milestones: v3.88.0, v3.90.0 Apr 25, 2024
@DanTup DanTup modified the milestones: v3.90.0, v3.92.0 May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked on dart / flutter Requires a change in Dart or Flutter to progress in debugger Relates to the debug adapter or process of launching a debug session in flutter Relates to running Flutter apps is bug
Projects
None yet
Development

No branches or pull requests

2 participants