-
Notifications
You must be signed in to change notification settings - Fork 318
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
"Select Device" doesn't work if the daemon has terminated, but provides no feedback #4510
Comments
Can you try enabling the daemon log in your VS Code user settings and getting a copy next time you see this?
I wonder if maybe the daemon is crashing? This came up in #4475 but I don't know what would cause it. If it's common for the daemon to crash we should probably restart is silently and file a flutter/flutter bug. If this was happening, you should see a toast notification saying it had terminated though. |
No toast, but I just tried to select a device 5 times, and it's not working. |
Seems like the daemon was working fine at 2:20am when it detected a device, and then at 9:56am it generated an error and terminated:
Is it possible the toast is collapsed in your notification bell (bottom right status bar)? VS Code hides notifications about 10-15s, and there were many hours between it terminating and you then trying to select a device. It's not clear to me why this error occurred when it did though.. there's no traffic from VS Code to the daemon, so presumably something happened within the tool that triggered this. I think perhaps the error reported here ("Unable to run adb") should be expanded to help debug this - what happened that made flutter_tools decide it couldn't be run? Could it not find it? Did it exit with an error? Did it produce unexpected output? We could update Dart-Code to silently restart the daemon the first X times this happens, and only report if it's crashed more than X times (although doing this probably requires a bunch of refactoring, since our current restart is to restart the whole extension which is too disruptive to do automatically). It'd be nice to track down what's causing this though (FYI @christopherfujino) |
So this error message means that running In that toolExit however, we interpolate at the end the caught exception, the message of which appears to just be the path to the binary it tried ( |
Actually, it looks like this is what happens when the process manager can't find the binary on the search path. This is getting delegated right to |
Yeah, that does sound odd. In #4475 both @kenzieschmoll and @polina-c noted that they see issues frequently which also appear to be the daemon terminating. I made some changes so that it doesn't block launching an app, but it doesn't address the real issue of the daemon being unresponsive. I don't know the cause is the same for all of them (or why we don't get more reports of this from external users). At a minimum, the VS Code extension should re-prompt about the daemon having terminated if someone tries to interact with it (eg. opening the device selector) after we know the process has terminated. The log file above suggests we just tried to send a message to it, despite the process being gone. |
Do you mean the Flutter daemon, or the adb one? |
The flutter one started by VS Code with In the log above, the second line about the process terminating refers to the
|
Ahh right, I see what you mean. I was trying to figure out why the process failed and you were talking about what DartCode should do WHEN the daemon exits. Should the daemon send an event before tool exiting? |
Well, I guess it did here (that message was from the ToolExit exception that was thrown, so something must have caught it), should we somehow mark that it's going to cause the daemon to crash? |
Dart-Code doesn't need anything extra - I'll change it to handle the termination better (initially just re-showing the "The flutter daemon has terminated" prompt if anything tries to call its APIs, giving the user a button to restart it). It might be nice to support automatically restarting it, but that needs some refactoring (in Dart-Code) to support restarting its services without a whole extension restart. I think all that's required of Flutter is probably helping understand exactly what happened that caused this exit. If it couldn't find the binary, why not? (what happened at |
The problem is that dart:io does not give us any futher information. |
Indeed, just happened again, and the Flutter daemon crash was collapsed in the notification bell. The relevant logs are
which is strange because both |
It looks like the error is reported here: } on ProcessException catch (exception) {
throwToolExit(
'Unable to run "adb", check your Android SDK installation and '
'$kAndroidSdkRoot environment variable: ${exception.executable}',
); But this is only including |
I've pushed a fix that will re-show the "Flutter daemon has terminated" prompt (although saying "is not running" in this condition) if something tries to call its API after it has already exited. Because I don't know how common this is and the API is called on every debug session launch, I have throttled it to only show once per 10 minutes (so if you run the command, ignore the prompt, then run it again, you won't see the prompt a second time unless it's been 10 minutes). We can remove this in future if we're sure this isn't a widespread issue (although if it is, we need to find a better fix). @christopherfujino should I open a flutter/flutter issue about trying to capture some more context in the error (see my comment above - #4510 (comment)) to help track down what's happening here? @guidezpl is the third person (coincidentally all Googlers) to have reported this kind of issue. |
Sure! |
I've opened flutter/flutter#125971 with some notes. @guidezpl the change I noticed above (re-showing the prompt up to once every 10 mins) is in the published Pre-release version, so if you're on that please let me know if you're not seeing it (or have any issues/feedback). Thanks! |
Will do, thanks! |
Describe the bug
After a bit of usage, tapping the device selector in the bottom right results in no action. The "Flutter: Select device" command also does nothing. Only restarting VS Code fixes the issue, temporarily.
To Reproduce
Unclear for now
Please complete the following information:
Logs
The text was updated successfully, but these errors were encountered: