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
Node.js processes *still* don't quit after stopping debugging #38897
Comments
Hello @casperOne, thanks for contacting us. Are you still experiencing this issue in .NET 6? |
Hi @casperOne. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@TanayParikh Yes, after switching to 6.0, after going through two debug sessions, there were 13 nodejs processes that were hanging around. |
Hmm that's certainly strange. We've had issues with processes not being killed after debugging, but having 13 errant processes after just 2 debug session seems very odd. Are you sure the processes are all being created by .NET / VS? Could you try using Proc Explorer to get an idea of the process hierarchy / tree? |
Hi @casperOne. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@TanayParikh I've looked into this more. While debugging, the process tree looks like this: You can see that the node instances are children of iisexpress. The full command line of the cmd.exe process that controls the nodejs process is
However, when I close the browser (effectively ending the debugging session), the cmd.exe (with the child nodejs processes) gets orphaned: |
Thanks @casperOne that's really helpful. Do you have a minimal, public, GitHub repro project that we could use to investigate further? Note we aren't able to use private repos |
@TanayParikh I will try and whittle this down to something I can post on a public repo. |
Thanks for contacting us. We're moving this issue to the |
Thanks for contacting us. @javiercn can you please look into this when you're back from vacation and see what's the culprit here? Thanks! |
@mkArtakMSFT @javiercn @TanayParikh I have a minimal example here https://github.com/casperOne/asp-net-core-react-spa-note-wont-shut-down It's my project, reduced to bare bones that sets up the ASP.NET Core side, displaying "Hello there" through React. I've confirmed that the behavior with orphaned nodejs processes occurs with this example. Note: You'll have to run |
Same here. I personally run a script every time after I'm done with debugging to get around with this. # powershell script
get-process | where {$_.Name -eq 'node'}| foreach {$_.Kill()} or with AutoHotKey(ctrl + k, ctrl + n) #k::
Input, OutputVar, L1
If (Asc(OutputVar) = Asc("n"))
{
If(FileExist("C:\Program Files\PowerShell\7\pwsh.exe"))
{
Run "C:\Program Files\PowerShell\7\pwsh.exe" -Command "get-process | where {$_.Name -eq 'node'} | foreach {$_.Kill()}"
}
}
Return It will simply kill all node processes. You can also make it part of the debug flow(add it to .csproj or launch.json), but it's not recommended. |
Yes, this (or some variation of this) can be done, the big problem is that it will kill other node processes that are running that are not involved with asp.net development. While this would apply to my case, I see this as a "break in case of emergency" solution that shouldn't be the common approach in this scenario (even if it is currently the only approach that works). |
Thanks for the repro project, @casperOne. Also note, that .NET 5 is out of support. |
Describe the bug
The same issue as #5204, many nodejs instances continue to run after debugging an ASP.NET Core application.
Currently, I am using
taskkill.exe /F /IM node.exe /T
to shut down instances after each debugging session to mitigate this. Here's a screenshot showing 18 nodejs processes running (all children of VS.NET) after debugging:One (or more) of these is typically (but not always) consuming a large amount of CPU.
It tends to slow down performance on my machine quite a bit after this.
To Reproduce
This is an ASP.NET Core React SPA application that was created with the template ~ASP.NET Core 2.1. It's been upgraded over time and is currently on ASP.NET Core 5.0.
Debugging occurs in VS.NET 2022.
I do have a private github repo that I'm willing to share privately to assist.
The text was updated successfully, but these errors were encountered: