Skip to content
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

Default diagnostic port regression in version 8.X #7229

Open
Bluezen opened this issue Aug 29, 2024 · 2 comments
Open

Default diagnostic port regression in version 8.X #7229

Bluezen opened this issue Aug 29, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@Bluezen
Copy link

Bluezen commented Aug 29, 2024

Description

Hello,
Since upgrading to version 8 of dotnet-monitor, we’ve noticed that no processes are being detected when using Connect mode and the default diagnostic port.

To reproduce this issue, start an application that exposes the /tmp folder in a volume (here named diag):

docker run -it -v diag:/tmp -p 8080:8080 mcr.microsoft.com/dotnet/samples:aspnetapp

then start dotnet-monitor with the same (diag) volume mounted:

docker run -it -v diag:/tmp -p 52323:52323 mcr.microsoft.com/dotnet/monitor:8 collect --urls "http://*:52323" --no-auth

When you access http://localhost:52323/processes, it returns an empty list []. We would expect to see some processes listed instead, like for example:

[{"pid":1,"uid":"79c27c06-eb74-4c49-bd41-93d6f4c4c93c","name":"aspnetapp","isDefault":true}]

as a dotnet-monitor in versions 6 or 7 behaved.

Regression?

To observe the change in behavior, simply update the version number to 7:

docker run -it -v diag:/tmp -p 52323:52323 mcr.microsoft.com/dotnet/monitor:7 collect --urls "http://*:52323" --no-auth

or version 6:

docker run -it -v diag:/tmp -p 52323:52323 mcr.microsoft.com/dotnet/monitor:6 --urls "http://*:52323" --no-auth

then access http://localhost:52323/processes, you should see some processes listed.

I’ve reviewed the documentation and couldn’t find any information about changes to configuration or behavior since version 8.
Am I overlooking something?

@Bluezen Bluezen added the bug Something isn't working label Aug 29, 2024
Copy link
Contributor

Welcome to dotnet-monitor!

Thanks for creating your first issue; let us know what you think of dotnet-monitor by filling out our survey.

@schmittjoseph
Copy link
Member

With .NET 8+ dotnet-monitor now runs as non-root in our images. This isn't an issue if both the application being monitored and dotnet-monitor run as the same user but if the users of the two applications mismatches, then we likely won't be able to connect. You can read more about this in our docs here.

When we originally released dotnet-monitor 8 the default ASP.NET sample application also ran as non-root so this wasn't an issue. It appears that this has since changed and the sample application run as root which means our image won't be able to monitor it.

Solutions (either will work):

  1. Switch to using the mcr.microsoft.com/dotnet/samples:aspnetapp-chiseled image instead. This runs as the same user as our dotnet-monitor image and should just work.
  2. Set the user of the mcr.microsoft.com/dotnet/samples:aspnetapp image to 1654:1654 (e.g. docker run -it --user 1654:1654 -v diag:/tmp -p 8080:8080 mcr.microsoft.com/dotnet/samples:aspnetapp)

We'll also look at updating our documentation around this.

@schmittjoseph schmittjoseph added documentation Improvements or additions to documentation and removed bug Something isn't working labels Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants