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

Getting command line via diagnostic pipe GetProcessInfo command during suspension only reports process name #59439

Open
jander-msft opened this issue Sep 21, 2021 · 2 comments
Labels
area-Tracing-coreclr enhancement Product code improvement that does NOT require public API changes/additions
Milestone

Comments

@jander-msft
Copy link
Member

Description

On a non-Windows platform, while a runtime instance is suspended, issuing the GetProcessInfo command on the diagnostic pipe will only return the process name for the command line field. None of the command line parameters are provided.

Configuration

All non-Windows platforms, both .NET 5 and .NET 6.

Regression?

No, my understanding is that during suspension on non-Windows platforms, this field never provided the full command line.

Other information

During suspension, the command line field in the GetProcessInfo response will be something like:

/__w/1/s/.dotnet/dotnet

If the GetProcessInfo command is issued immediately after resuming the runtime, the same data is reported (only the process name).

If the GetProcessInfo command is issued sometime after the runtime is resumed and has run for a bit, then it returns the proper command line, e.g.:

/__w/1/s/.dotnet/dotnet /__w/1/s/artifacts/bin/Microsoft.Diagnostics.Monitoring.UnitTestApp/Release/net5.0/Microsoft.Diagnostics.Monitoring.UnitTestApp.dll AsyncWait

cc @josalem

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Diagnostics.Process untriaged New issue has not been triaged by the area owner labels Sep 21, 2021
@ghost
Copy link

ghost commented Sep 21, 2021

Tagging subscribers to this area: @dotnet/area-system-diagnostics-process
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

On a non-Windows platform, while a runtime instance is suspended, issuing the GetProcessInfo command on the diagnostic pipe will only return the process name for the command line field. None of the command line parameters are provided.

Configuration

All non-Windows platforms, both .NET 5 and .NET 6.

Regression?

No, my understanding is that during suspension on non-Windows platforms, this field never provided the full command line.

Other information

During suspension, the command line field in the GetProcessInfo response will be something like:

/__w/1/s/.dotnet/dotnet

If the GetProcessInfo command is issued immediately after resuming the runtime, the same data is reported (only the process name).

If the GetProcessInfo command is issued sometime after the runtime is resumed and has run for a bit, then it returns the proper command line, e.g.:

/__w/1/s/.dotnet/dotnet /__w/1/s/artifacts/bin/Microsoft.Diagnostics.Monitoring.UnitTestApp/Release/net5.0/Microsoft.Diagnostics.Monitoring.UnitTestApp.dll AsyncWait

cc @josalem

Author: jander-msft
Assignees: -
Labels:

area-System.Diagnostics.Process, untriaged

Milestone: -

@josalem
Copy link
Contributor

josalem commented Sep 23, 2021

I took a look at the code paths for this and I think this unfortunately falling prey to the same ordering problems that the assembly name does, namely, part of command line resolution happens in the host. This means we are stuck waiting on the host to populate the command line.

Specifically, the runtime suspends in EEStartupHelper in ceemain.cpp, which gets called by CorHost2::Start, but the command line that we use doesn't get populated until CorHost2::ExecuteAssembly is called. I'm not entirely sure why we have a partial population of the value while suspended honestly. I'll have to put it under a debugger and see when that value is being put there.

The main issue is that on non-Windows platforms, we calculate the commandline rather than read it from some system API. The host is using the assembly path for the main assembly to generate it.

@josalem josalem self-assigned this Sep 23, 2021
@tommcdon tommcdon modified the milestones: 7.0.0, Future May 17, 2022
@tommcdon tommcdon added the enhancement Product code improvement that does NOT require public API changes/additions label May 17, 2022
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label May 12, 2023
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Tracing-coreclr enhancement Product code improvement that does NOT require public API changes/additions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants