Skip to content

dotnet watch grows my app's memory until it freezes my system #67012

@MeikelLP

Description

@MeikelLP

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Similar to #59027

I have the same issue though my symptoms are quite different:

  • I ever only get 1 hot reload and have to restart after that. I never got a second hot reload.
  • The app keeps taking memory (idle is ~250mb, after hot reload growing and growing 20+GB until my system freezes and the kernel kills the process)
Image Image
  • The memory growing starts exactly after the second try of hot reload

I assume this may be a bug in my application but I get zero errors from dotnet watch or in the Aspire dashboard.

dotnet watch --verbose

dotnet watch ⌚ File updated: /src/Service.BrokerPortal/Components/Pages/Page.razor.cs
dotnet watch ⌚ Updating document text of '/src/Service.BrokerPortal/Components/Pages/Page.razor.cs'.
dotnet watch ⌚ Solution after document update: v3
dotnet watch 🔥 Hot reload capabilities: AddExplicitInterfaceImplementation AddFieldRva AddInstanceFieldToExistingType AddMethodToExistingType AddStaticFieldToExistingType Baseline ChangeCustomAttributes GenericAddFieldToExistingType GenericAddMethodToExistingType GenericUpdateMethod NewTypeDefinition UpdateParameters.
dotnet watch 🔃 [Service.BrokerPortal (net10.0)] Updating diagnostics.
dotnet watch 🔥 [Service.BrokerPortal.AppHost (net10.0)] Sending update batch #1
dotnet watch 🕵 [Service.BrokerPortal.AppHost (net10.0)] Applying updates to module 04552c6a-2367-41c3-a4a2-d48f2e9dbf72.
dotnet watch 🕵 [Service.BrokerPortal.AppHost (net10.0)] Invoking metadata update handlers.
dotnet watch 🕵 [Service.BrokerPortal.AppHost (net10.0)] System.Reflection.Metadata.RuntimeTypeMetadataUpdateHandler.ClearCache
dotnet watch 🕵 [Service.BrokerPortal.AppHost (net10.0)] System.Text.Json.JsonSerializerOptionsUpdateHandler.ClearCache
dotnet watch 🕵 [Service.BrokerPortal.AppHost (net10.0)] Microsoft.Extensions.DependencyInjection.ActivatorUtilities+ActivatorUtilitiesUpdateHandler.ClearCache
dotnet watch 🕵 [Service.BrokerPortal.AppHost (net10.0)] System.ComponentModel.ReflectionCachesUpdateHandler.ClearCache
dotnet watch 🕵 [Service.BrokerPortal.AppHost (net10.0)] Microsoft.AspNetCore.Routing.RouteValueDictionary+MetadataUpdateHandler.ClearCache
dotnet watch 🕵 [Service.BrokerPortal.AppHost (net10.0)] Microsoft.Extensions.Internal.PropertyHelper+MetadataUpdateHandler.ClearCache
dotnet watch 🕵 [Service.BrokerPortal.AppHost (net10.0)] Microsoft.Extensions.Internal.PropertyHelper+MetadataUpdateHandler.ClearCache
dotnet watch 🕵 [Service.BrokerPortal.AppHost (net10.0)] Microsoft.Extensions.Internal.PropertyHelper+MetadataUpdateHandler.ClearCache
dotnet watch 🕵 [Service.BrokerPortal.AppHost (net10.0)] Updates applied.
dotnet watch 🔥 [Service.BrokerPortal.AppHost (net10.0)] Update batch #1 completed.

From what I can see the second hot reload try isn't even logged but at that point the app is stuck at ~20% CPU and 2GB (from ~250MB when idle)

What other options do I have to diagnose this?

Expected Behavior

No response

Steps To Reproduce

Unknown

Exceptions (if any)

No response

.NET Version

10.0.300

Anything else?

.NET SDK:
 Version:           10.0.300
 Commit:            caa81fa497
 Workload version:  10.0.300-manifests.502164c0
 MSBuild version:   18.6.3+caa81fa49

Runtime Environment:
 OS Name:     debian
 OS Version:  13
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/10.0.300/

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
  Version:      10.0.8
  Architecture: x64
  Commit:       94ea82652c

.NET SDKs installed:
  8.0.420 [/usr/share/dotnet/sdk]
  9.0.313 [/usr/share/dotnet/sdk]
  10.0.300 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.26 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.15 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 10.0.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.26 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.15 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 10.0.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions