Skip to content

dotnet-dsrouter not connecting on iOS - "Failed connecting 9191 over usbmux, wait 500 ms before retrying." #4058

Description

@kcoop

I'm attempting to create a .nettrace file to track down memory leaks in a Maui iOS app running on an iPhone tethered via USB to a Mac, but haven't yet been able to capture any telemetry with dotnet-trace and dotnet-dsrouter.

Following the instructions here:

https://github.com/xamarin/xamarin-android/blob/main/Documentation/guides/tracing.md

Install dotnet-dsrouter and dotnet-trace:

$ dotnet-dsrouter --version
WARNING: dotnet-dsrouter is a development tool not intended for production environments.

7.0.435501+b56bae8476fb1a944de6618b4aa2b602db05b8b3

$ dotnet trace --version
7.0.430602+c9c987585e1fa9a8a8a5e1ffb60a70f85b0da4ca

Launch the app:

$ mlaunch --launchdev MyApp.app --wait-for-exit --argument --connection-mode --argument none '--setenv:DOTNET_DiagnosticPorts=127.0.0.1:9191,suspend,listen'

It starts up and waits as expected:

Press enter to terminate the application
>The runtime has been configured to pause during startup and is awaiting a Diagnostics IPC ResumeStartup command from a Diagnostic Port.
DOTNET_DiagnosticPorts="127.0.0.1:9191,suspend,listen"
DOTNET_DefaultDiagnosticPortSuspend=0

Start dotnet-dsrouter:

$ dotnet-dsrouter server-client -ipcs /tmp/maui-app-port -tcpc 127.0.0.1:9191 --forward-port iOS -v trace -rt 100

It seems healthy at this point too:

info: dotnet-dsrouter[0]
      Starting IPC server (/tmp/maui-app-port) <--> TCP client (127.0.0.1:9191) router.
trce: dotnet-dsrouter[0]
      Calling AMDeviceNotificationSubscribe.
dbug: dotnet-dsrouter[0]
      Trying to create a new router instance.
dbug: dotnet-dsrouter[0]
      Waiting for new ipc connection at endpoint "/tmp/maui-app-port".
trce: dotnet-dsrouter[0]
      Start dispatching notifications.
trce: dotnet-dsrouter[0]
      AMDeviceNotificationInternal callback, device=5274562304, action=Connected
info: dotnet-dsrouter[0]
      Successfully connected new device, id=4.

Start dotnet trace to get a dump (unlike the tracing instructions I added ',connect' to the port, omitting it throws an Address already in use exception):

$ dotnet-trace collect --providers Microsoft-DotNETRuntimeMonoProfiler:0xC900003:4 --diagnostic-port /tmp/maui-app-port,connect

At this point, the dotnet-trace just sits, and these flow by in the dotnet-dsrouter output until I quit:

trce: dotnet-dsrouter[0]
      Failed connecting 9191 over usbmux, wait 500 ms before retrying.

Which looks to be emanating from here:

_logger?.LogTrace($"Failed connecting {_port} over usbmux, wait {TcpClientRetryTimeoutMs} ms before retrying.");

I have seen #3134 by @rolfbjarne which sounded possibly relevant, but we are on a much later version, so I imagine that fix is already in 7.0.435501.

Any ideas on how to get this working? It would really help see this data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions