-
Notifications
You must be signed in to change notification settings - Fork 374
setclrpath fails with "Runtime required" when debugging live process #5284
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
Comments
Interestingly, if I run
/path/to/my/self-contained/app/Azure.Core.dll exists. /opt/dotnet-sdk/sos/Azure.Core.dll also exists. Perhaps SOS is somehow getting confused between those two. |
@loop-evgeny |
Has libcoreclr.so loaded yet? Did you execute |
@mikem8361 Yes, libcoreclr.so has loaded. The process was already running before LLDB was attached to it. @hoyosjs Thanks! OK, so with
So it seems like I need
It's unclear to me which runtime that should be. In this case it happens to be the same as the self-contained app's runtime (8.0.13) and the only one installed with the SDK. But what if I installed SDK 8.0 with runtime 9.0 and the self-contained app was running on 6.0? If what SOS needs is the "default" runtime installed with the SDK (same major and minor version) why can't it just find that itself based on its own path? |
Also, this is a regression - what I tried to do (sethostruntime to the app's dir, no setclrpath) works on Ubuntu 22.04.5 with lldb 14.0.0, .NET SDK 7.0.410:
I then tried it on the same machine, with the same app, but with .NET SDK 8.0.406 and got the problem in the original issue. So this appears to have been broken by .NET SDK 8, rather than the Ubuntu 22->24 upgrade, which makes sense. |
Setclrpath tells sos which app runtime you're debugging. This should point to your app only and should usually be not needed unless you're doing custom runtime kind of scenario. Be default SOS will try to find the runtime of your app and look for debugging DLLs for that given runtime. I am not sure why it didn't automatically find it in your session, I believe 7.0 runtime was a Microsoft provided one and 8.0 comes from Canonical - but I'd have to verify to say for sure. sethostruntime is... A command that is pointing to an odd place: the directory of the runtime/folder containing coreclr that's meant to host the managed commands of SOS. It's meant to point to an SDK style runtime dir/standalone global runtime dir. In your original post it should have pointed to |
OK, so the fact that it worked with .NET SDK 7.0 with But why is SOS not able to find its runtime (at ../shared/Microsoft.NETCore.App/X.Y.Z) automatically? Having to script finding the runtime folder is annoying, and it worked without that before. Is there any documentation explaining all this stuff? I could not find it. https://learn.microsoft.com/en-us/dotnet/core/diagnostics/sos-debugging-extension has a command reference, including those two, but I don't know what "dac/dbi" is and nowhere does it say: "to debug a self-contained application using SOS here is what you need to do: ..." |
If the runtime is installed globally, SOS picks it up. Otherwise, it's the users job to tell it what's "trustworthy". It follows classic .NET rules:
|
Alright, so I have to script finding the runtime somehow. I hope you can see how all this is totally not intuitive from the point of view of a user of SOS:
It's really a usability minefield. It certainly needs better documentation, but SOS itself really needs to give more helpful error messages to the user. Unhelpful messages include:
... and all of that is just from this one "experience" with SOS. |
Description
I use LLDB to attach to a live .NET process using self-contained deployment, and load SOS:
It appears to work, although the "version 0.0" looks suspicious! Some SOS commands then fail, however:
Configuration
Running on Ubuntu 24.04.2 x64, physical machine, no containerization, lldb version 18.1.3. The .NET app is self-contained, built on an Ubuntu 22.04 machine using .NET SDK 8.0.404.
.NET runtime is not installed globally on the machine running , but .NET SDK 9.0.2 was downloaded to /opt/dotnet-sdk and SOS was installed there using
dotnet tool
. The same also happens with .NET SDK 8.0.406.Regression?
Worked on Ubuntu 22.04 with .NET 8 SDK, at least.
Other information
The only relevant issue I could find was #3222, but that was about a core dump, not a live process. I have checked that libcoreclr.so is loaded in my case:
The app directory also contains libmscordaccore.so.
The text was updated successfully, but these errors were encountered: