Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dotnet-stack should filter out its immediate parent dotnet process if any #2977

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

Open
danmoseley opened this issue Apr 4, 2022 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@danmoseley
Copy link
Member

C:\Users\dan>dotnet stack ps
 2616  dotnet           [Elevated process - cannot determine path]
 2668  dotnet           [Elevated process - cannot determine path]
 4328  dotnet           C:\Program Files (x86)\dotnet\dotnet.exe     stack ps
 2560  MicroBenchmarks  [Elevated process - cannot determine path]

@hoyosjs
Copy link
Member

hoyosjs commented Apr 4, 2022

hmm, that's odd - we filter that out

if (process.Id == currentPid)
{
continue;

What version are you using?

@danmoseley
Copy link
Member Author

Sorry, I should have mentioned this is current 6.0 one. But the lines above seem like they should be in there - hmm

C:\temp>dotnet stack --version
6.0.320101+2aa2e938aad310fd667f926c7217b990568e2783

C:\temp>dotnet stack ps
 2616  dotnet           C:\git\performance\tools\dotnet\x86\dotnet.exe                                         =10, MinIterationCount=15, MinWarmupIterationCount=6, UnrollFactor=1, WarmupCount=-1" --benchmarkId 1306
 2668  dotnet           C:\git\performance\tools\dotnet\x86\dotnet.exe                                         no-restore --no-build -- --filter * --packages C:\git\performance\artifacts\packages --buildTimeout 1200
 4116  dotnet           C:\Program Files (x86)\dotnet\dotnet.exe                                                stack ps
 2560  MicroBenchmarks  "C:\git\performance\artifacts\bin\MicroBenchmarks\Release\net7.0\MicroBenchmarks.exe"   --filter * --packages C:\git\performance\artifacts\packages --buildTimeout 1200

and on another machine

C:\temp>taskkill /im dotnet.exe
ERROR: The process "dotnet.exe" not found.

C:\temp>dotnet stack --version
6.0.257301+27172ce4d05e8a3b0ffdefd65f073d40a1b1fe54

C:\temp>dotnet stack ps
     44696 dotnet     C:\Program Files\dotnet\dotnet.exe

@danmoseley
Copy link
Member Author

Hmm, I verified it is using this one
C:\USERS\DANMOSE.DOTNET\TOOLS.STORE\DOTNET-STACK\6.0.257301\DOTNET-STACK\6.0.257301\TOOLS\NETCOREAPP3.1\ANY\DOTNET-STACK.DLL

which per ILSPY contains that code.

@danmoseley
Copy link
Member Author

Ah, I see the bug. It works if I do "dotnet-stack ps". If I do "dotnet stack ps" it filters out "dotnet-stack.exe" but isn't aware of its parent dotnet.exe. It needs to find that and filter it.

It needs a little pinvoking and checking the process start time as there's no managed API currently: dotnet/runtime#24423

@danmoseley danmoseley changed the title dotnet-stack should filter out itself dotnet-stack should filter out its immediate parent dotnet process if any Apr 4, 2022
@hoyosjs hoyosjs added the enhancement New feature or request label Apr 6, 2022
@hoyosjs
Copy link
Member

hoyosjs commented Apr 6, 2022

Makes sense. When we do this we just need to make sure this is filtering just dotnet stack invocation and not any managed invocation of the native dll.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants