dotnet / aspire

An opinionated, cloud ready stack for building observable, production ready, distributed applications in .NET
https://learn.microsoft.com/dotnet/aspire
MIT License
3.79k stars 447 forks source link

Aspire 9 preview 1 processes take long time to shut down #6437

Open jack775544 opened 1 day ago

jack775544 commented 1 day ago

Is there an existing issue for this?

Describe the bug

I have an Aspire project that contains a mix of container resources, executable resources (all running node) and project resources. After testing Aspire 9 preview 1, I have noticed that on shutting down the app host, the non container resources take a considerable time to shut down or in some cases, do not shut down at all. This also includes the dashboard process not shutting down as well.

In my project, I have no persistent resources.

Expected Behavior

After shutting down the app host, all services should be shut down.

Steps To Reproduce

Exceptions (if any)

No response

.NET Version info

.NET SDK:
 Version:           8.0.403
 Commit:            c64aa40a71
 Workload version:  8.0.400-manifests.c15ea148
 MSBuild version:   17.11.9+a69bbaaf5

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22631
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.403\

.NET workloads installed:
Configured to use loose manifests when installing new manifests.
 [aspire]
   Installation Source: VS 17.11.35327.3
   Manifest Version:    8.2.0/8.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.0\WorkloadManifest.json
   Install Type:        FileBased

Host:
  Version:      8.0.10
  Architecture: x64
  Commit:       81cabf2857

.NET SDKs installed:
  6.0.427 [C:\Program Files\dotnet\sdk]
  8.0.206 [C:\Program Files\dotnet\sdk]
  8.0.403 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Anything else?

I have seen this behaviour from running the AppHost from the command line and from Rider.

davidfowl commented 1 day ago

See https://github.com/dotnet/aspire/issues/6221#issuecomment-2408002558, this should be fixed in later builds.

jack775544 commented 1 day ago

See #6221 (comment), this should be fixed in later builds.

Sounds good. The only thing different from that ticket is that I am also getting this for project resources and the dashboard as well.

davidfowl commented 1 day ago

Sounds good. The only thing different from that ticket is that I am also getting this for project resources and the dashboard as well.

Can you reproduce this with a new started project?

jack775544 commented 1 day ago

I just gave it a go on a new project by doing dotnet new aspire-starter and upgrading it to 9.0.0-rc.1.24511.1.

Shutting down the project worked fine there.

I then added a node project and after that it caused the project resources to not stop correctly. My test repo is here, though it sounds like this problem is pretty well understood at this point https://github.com/jack775544/AspireStopBug

davidfowl commented 1 day ago

Seems like the same problem. If you want to try out a newer build, you can try:

dotnet new install Aspire.ProjectTemplates::9.0.0-rc2* --force

You'll get new templates with the fix.

davidfowl commented 1 day ago

You should be able to switch back to the RC1 templates easily as well