Messages lost when printed shortly after a hot restarting a web app
- Dominant language
- Dart
- Stars
- 224
- Forks
- 94
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 2
Description
```dart
import 'dart:async';
main() async {
for (var i = 0; i < 10; i++) {
print('Tick: $i');
await Future.delayed(Duration(seconds: 1));
}
}
```
If you run this app and wait for the ticks to print you will see "Tick: 0" to "Tick: 9" printed in the chrome developer console. If you ran the app with vscode and look in the Debug Console you will see the same prints there as well.
Then if you restart the app you will see all ticks "Tick: 0" to "Tick: 9" printed in the chrome developer console but some of the first prints don't make it through to the vscode Debug Console. In my screenshot you can see after the hot restart "Tick: 0" is missing.
This is a problem in Flutter web as well. I spent a while trying to debug a hot restart test because it was relying on this communication and since the first print didn't come through the test thought the hot restart didn't work.
It turns out this is a known issue and if you really need the message to be delivered the workaround is to print it many times https://github.com/flutter/flutter/issues/86202.
Contributor guide
Research direction
Reproduce the Dart sample with webdev, a hot restart, and VS Code's Debug Console; compare it with Chrome's console to confirm that an early Tick message is dropped. Trace the output-forwarding path involved in hot restart, and consider the issue resolved when the first message after restart reliably reaches VS Code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, vscode
- Domain
- devtools, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100