flutter-embedded-linux icon indicating copy to clipboard operation
flutter-embedded-linux copied to clipboard

flutter-client fails to start Dart VM HTTP Service

Open LeoBound opened this issue 2 years ago • 8 comments

Hi,

I've built the debug wayland recipes using meta-flutter and can run flutter apps in debug mode. Whenever I start a flutter app (by using flutter-client -b /path/to/bundle) I get the following error

flutter: Could not start Dart VM service HTTP server:
SocketException: Failed to create server socket (OS Error: Cannot assign requested address, errno = 99), address = 127.0.0.1, port = 0
#0      _NativeSocket.bind (dart:io-patch/socket_patch.dart:996:7)
<asynchronous suspension>
#1      Server.startup.startServer (dart:vmservice_io/vmservice_server.dart:424:19)
<asynchronous suspension>
#2      Server.startup (dart:vmservice_io/vmservice_server.dart:443:11)
<asynchronous suspension>

and subsequently I am unable to attach the debugger. This also fails when using flutter custom-devices on a host machine to try and debug (same error).

Why would this be, is there a way to see a more verbose log?

Thanks

LeoBound avatar Aug 11 '22 14:08 LeoBound

Are you using docker? If yes, does this issue help you?

HidenoriMatsubayashi avatar Aug 12 '22 01:08 HidenoriMatsubayashi

Unfortunately not - I'm running it on some embedded hardware where I added meta-flutter to the yocto build process.

LeoBound avatar Aug 12 '22 07:08 LeoBound

Sorry, I can't debug any further as I don't know your environment. Are you using flutter-elinux? How did you create /path/to/bundle?

HidenoriMatsubayashi avatar Aug 12 '22 08:08 HidenoriMatsubayashi

The bundle was created with flutter build bundle with the standard flutter tool. After these errors the application does run as expected - there is just no way to debug it. Could you let me know what details you need to know about the environment? It's a custom board with an iMX6.

Thanks

LeoBound avatar Aug 12 '22 09:08 LeoBound

Are you trying to attach your flutter app from your host PC or just launching it on arm64 devices?

HidenoriMatsubayashi avatar Aug 12 '22 12:08 HidenoriMatsubayashi

After these errors the application does run as expected - there is just no way to debug it.

I think that the settings related to the network/port of the device you are using are affecting the error. But no one can advise without repro steps, commands, and whole logs.

HidenoriMatsubayashi avatar Aug 12 '22 12:08 HidenoriMatsubayashi

Do you know where could I find more verbose logs?

The logs in my first post are the output of flutter-client -f -b /path/to/bundle. Does flutter-client or the flutter engine output any other logs, I couldn't find any in /var/logs.

My steps were:

  • Add meta-flutter to my yocto distro and building in debug mode
  • Upload the image to the device
  • Add the device with flutter custom-devices with the flutter SDK (3.0.5)
    • for the command I launch it with XDG_RUNTIME_DIR=/tmp/-runtime-dir flutter-client -f -b /tmp/${appName}
  • I get the error in the log about being unable to create the server socket.

I'm using dropbear for SSH access instead of OpenSSH, could this be why?

LeoBound avatar Aug 16 '22 09:08 LeoBound

Add the device with flutter custom-devices with the flutter SDK (3.0.5)

Why are you using the official flutter SDK? Could you try using flutter-elinux once?

HidenoriMatsubayashi avatar Aug 16 '22 09:08 HidenoriMatsubayashi

Closing as no update for a while.

HidenoriMatsubayashi avatar Aug 04 '23 20:08 HidenoriMatsubayashi