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

[Aspire]: dotnet watch kills process tree on windows and does not let DCP cleanup containers #44542

Closed
davidfowl opened this issue Oct 31, 2024 · 6 comments

Comments

@davidfowl
Copy link
Member

davidfowl commented Oct 31, 2024

CTRL+C on windows I haven't verified non-windows, shuts down the process tree including dcp which does not allow it to properly clean up containers. This means that running watch and using Ctrl + C leaves containers running (a leak).

I made an app using:

dotnet new aspire-starter --use-redis-cache -o DemoApp
watchungraceful.mp4
@davidfowl
Copy link
Member Author

This still reproduces with 9.0.200-preview.0.24551.17+aea7b5075c8933b1c6d7ac59d40a7cabb0da6af1, which is after the fix was made.

@tmat tmat closed this as completed Nov 24, 2024
@tmat tmat reopened this Nov 24, 2024
@davidfowl
Copy link
Member Author

cc @karolz-ms

@karolz-ms
Copy link
Member

I thought @tmat had a fix for this... allowing DCP escape from the job dotnet watch sets up (setting JOB_OBJECT_LIMIT_BREAKAWAY_OK on it)

@tmat
Copy link
Member

tmat commented Jan 10, 2025

I don't have a fix. What exactly should dotnet-watch do? We are launching the project using dotnet run. dotnet-watch does not create the actual app process.

@karolz-ms
Copy link
Member

OK. Last time I checked, DCP launched via dotnet watch (on Windows) was part of a Job that had had JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag set somewhere in the SDK. And then when the ProcessReaper https://github.com/dotnet/sdk/blob/main/src/Cli/Microsoft.DotNet.Cli.Utils/ProcessReaper.cs deletes that job, all the processes inside it get killed cold.

So the ask is to change the SDK to set JOB_OBJECT_LIMIT_BREAKAWAY_OK on that Job, so that DCP can "break away" and regain control over its destiny. Maybe as an opt-in that dotnet watch would use.

@davidfowl
Copy link
Member Author

@baronfel can you help with the investigation here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants