-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
For diagnostic tools that want to load an ICorProfilerCallback implementation using the diagnostic communication channel's AttachProfiler command need to understand the architecture and libc type (glibc vs musl libc) in order to provide a path to profiler assembly with the matching architecture and libc type.
For tools that are not running in the same process namespace (e.g. dotnet-monitor), this is nearly impossible to determine based on any of the information available while the target process is suspended. The latest process info (ProcessInfo2) command has OS and architecture information, but lacks libc type information. The environment block doesn't contain enough information to form a heuristic either; the following is an example environment block of an ASP.NET 6 Alpine container:
{
"PATH":"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"HOSTNAME":"deploy-exampleapp-75cc844674-62w2q",
"ASPNETCORE_URLS":"http://+:8080",
"DOTNET_RUNNING_IN_CONTAINER":"true",
"DOTNET_SYSTEM_GLOBALIZATION_INVARIANT":"true",
"DOTNET_VERSION":"6.0.8",
"ASPNET_VERSION":"6.0.8",
"DOTNET_DiagnosticPorts":"/diag/port",
"KUBERNETES_PORT_443_TCP_PORT":"443",
"KUBERNETES_PORT_443_TCP_ADDR":"10.0.0.1",
"KUBERNETES_SERVICE_HOST":"10.0.0.1",
"KUBERNETES_SERVICE_PORT":"443",
"KUBERNETES_SERVICE_PORT_HTTPS":"443",
"KUBERNETES_PORT":"tcp://10.0.0.1:443",
"KUBERNETES_PORT_443_TCP":"tcp://10.0.0.1:443",
"KUBERNETES_PORT_443_TCP_PROTO":"tcp",
"HOME":"/root"
}The diagnostic pipe protocol should be updated with a new command (ProcessInfo3) that contains enough information to differentiate the libc type. Alternatively, this command could return the non-distribution specific runtime identifier (e.g. linux-x64, linux-musl-x64, osx-arm64, win-x86, etc), which is commonly used for packing assets for platform variations into the same package.