Dart-Code: Error waiting for a debug connection: The log reader stopped unexpectedly.
App runs from Terminal running flutter run
in release or debug mode.
App runs directly from Intellij IDE.
App does not run launching from vscode.
flutter doctor
Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel dev, 1.26.0-1.0.pre, on Linux, locale pt_PT.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) [✓] Chrome - develop for the web [✓] Linux toolchain - develop for Linux desktop [✓] Android Studio [✓] IntelliJ IDEA Community Edition (version 2020.3) [✓] Connected device (2 available)
• No issues found!
vscode Version: 1.52.1 Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523 Date: 2020-12-16T16:32:10.090Z Electron: 9.3.5 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Linux x64 5.8.0-34-generic snap
vscode flutter extensions Flutter Version: 3.18.1 Dart Version: 3.18.1
Steps to Reproduce
Using Ubuntu 20.04.1 LTS
- Install Flutter SDK
- Change channel to dev
- flutter config --enable-linux-desktop
- Create a project
- Open project on vscode
- Launch the project using
Linux
as default device
Expected results: The Flutter app to show up
Actual results:
Launching lib/main.dart on Linux in debug mode...
lib/main.dart:1
Error waiting for a debug connection: The log reader stopped unexpectedly.
Error launching application on Linux.
Exited (sigterm)
DEBUG CONSOLE Launching lib/main.dart on Linux in debug mode… lib/main.dart:1 Error waiting for a debug connection: The log reader stopped unexpectedly. Error launching application on Linux. Exited (sigterm)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 26 (11 by maintainers)
@maks I would add a note on https://github.com/flutter/flutter/issues/73611 with any extra info you can provide. There’s not much going on the in the VS Code extension here (it’s just spawning Flutter) so it may be helpful to get some clarification from Flutter about exactly what “The log reader stopped unexpectedly” means on Linux (I wasn’t able to figure that out from the code).
The shell used in VS Code’s terminal shouldn’t change anything here - it’s not used for spawning the Flutter process in the VS Code debugger. We spawn the process using child_process.spawn(), and we do pass
shell: true
which according to the docs “Default: ‘/bin/sh’ on Unix, process.env.ComSpec on Windows.”.It’s probably worth making notes about anything you discover on the Flutter issue so they’re in one place/an open issue (although it sounds like the shell might not be related after all).
Oh sorry @DanTup I only just noticed your instructions at the top of this issue on how to grab debug logs. So I got the logs and seems mine are happening in similiar spot as well:
And running in VSCode terminal pane the exact same cmd as is in the log starts the app fine. I’ve not been able to reproduce the error when running in a norma terminal either.
@DanTup I’m not sure if the previous conclusions in this issue were correct. I’ve tried running from within my vscode terminal using the command args listed in the previous comments and the app runs fine. Its only when I try to run it with the codelens
debug
link or F5 that I get the error mesg about logger reader stopped. The previous comments about it being related to Wayland maybe something as I’m am using Wayland on this machine too.Are you using Wayland too? I saw there were some unresolved issues about Wayland in VS Code, though I don’t know if they’re related:
In https://github.com/flutter/flutter/issues/73611, @ruicraveiro mentioned having this Wayland(?) but not with X11. Do you know if this may apply here? I’m not very familiar with Linux (and had never heard of Wayland) unfortunately.
Given this occurs from the built-in terminal though, I’m not sure there’s anything that can be fixed here (in the VS Code extension repo) - as the terminal is entirely handled by VS Code. Whether it’s a VS Code bug/limitation or something else, I’m really not sure.