aspnetcore: Node.js processes *still* don't quit after stopping debugging

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:

image

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.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 15 (9 by maintainers)

Most upvoted comments

@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 yarn install in the ClientApp directory to initialize the node_modules directory before debugging.

Thanks for contacting us.

We’re moving this issue to the .NET 7 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it’s very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@TanayParikh I’ve looked into this more. While debugging, the process tree looks like this:

image

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

"cmd" /c npm run start -- 

However, when I close the browser (effectively ending the debugging session), the cmd.exe (with the child nodejs processes) gets orphaned:

image