Skip to content

[MCP Server] 1.4.16 leaks millions of Windows handles, causing severe memory pressure #15132

Open

Description

@grantericstrong

Summary

NuGet.Mcp.Server 1.4.16 accumulated millions of handles during a long-running VS Code Copilot SDK Agent Host session. Memory usage reached 96% on a 32 GB Windows machine and fell to 64% after disabling and terminating the servers, without rebooting.

Environment

  • Windows 11 Pro x64, build 26300; 31.49 GiB physical RAM
  • VS Code 1.144.0; .NET SDK 10.0.401
  • chat.mcp.assisted.nuget.enabled was enabled
  • Launch: dotnet tool execute NuGet.Mcp.Server@1.4.16 --source https://api.nuget.org/v3/index.json --yes

Measured evidence

One Copilot runtime started two server instances about 11 minutes apart. Several hours later, each had:

  • ~4.82 million handles
  • ~2.7 GiB private memory (up from ~1 GiB earlier)
  • 498 additional handles over 10 seconds, consuming ~5.5 CPU seconds

Machine-wide kernel pools reached ~22.7 GiB paged and ~7 GiB nonpaged. After termination, paged pool visibly declined, including ~0.5 GiB reclaimed in 20 seconds. Process records temporarily remained with zero handles and one thread during cleanup; overall RAM usage subsequently fell from 96% to 64%.

Expected / investigation needed

Handle and memory usage should remain bounded. This was observed in a real development session; no minimal reproduction or handle-type/pool-tag attribution was captured. We did not invoke NuGet MCP tools during the investigation.

Recovery strongly implicates the server or its dependencies, but not every kernel allocation has been attributed to it. Please investigate per-instance handle growth; the host retaining two instances may be a separate VS Code/Copilot lifecycle issue.

Activity

  1. dotnet-policy-service commented on Nov 2, 2026

    @dotnet-policy-service
    Contributor

    Issue is missing Type label, remember to add a Type label

  2. added
    missing-required-type
    on Nov 2, 2026
  3. added and removed
    missing-required-type
    on Nov 5, 2026
  4. added
    Product:MCPServer
    Tenet:Performance
    and removed on Nov 6, 2026
  5. grantericstrong commented on Nov 7, 2026

    @grantericstrong
    Author

    Latest status report: The NuGet MCP server has 15.6 million handles and uses 6.8 GB of private memory. Windows also has 33.2 GB allocated to kernel pools—consistent with a severe handle leak.

    This seems severe? Or am I doing something wrong?

  6. kartheekp-ms commented on Nov 10, 2026

    @kartheekp-ms
    Contributor

    @grantericstrong were you able to reproduce this issue on a solution with single class library project? You can create a nuget.config file for that solution using dotnet new nugetconfig command.

  7. grantericstrong commented on Nov 10, 2026

    @grantericstrong
    Author

    This was a multi-project solution and I have the C# Dev Kit in VS Code. I had multiple Windows open and multiple agent conversations in parallel. I'm not sure that was the problem. This kept reoccurring. I disabled the experimental setting in VS Code related to the NuGet MCP server but it started up again anyway. Possible from the Copilot runtime? Every time it is running it would consume all the memory it could and continuously burn CPU. I disabled the MCP server globally and it at least doesn't start now.

  8. jeffkl commented on Nov 23, 2026

    @jeffkl
    Contributor

    Thanks for the detailed report. We tried to reproduce this on Windows build 26300 with 1.4.16 and haven't seen any growth yet. We tested launch via dotnet tool execute on SDK 10.0.401, idle sessions, parallel and cancelled tool calls against a 13-project CPM solution, an unreachable telemetry endpoint, and abrupt host disconnects. All stayed under ~900 handles, and CPU returned to zero when idle.

    If it happens again, could you capture the following from the growing process before killing it? Run everything from an elevated prompt.

    1. Which process is growing. Please send the image path and parent of the process. The process whose command line contains NuGet.Mcp.Server@1.4.16 is the dotnet.exe launcher, not the server itself:
      Get-CimInstance Win32_Process | ? { $_.CommandLine -match 'NuGet.Mcp.Server|nuget.mcp.server' } | select ProcessId,ParentProcessId,Name,ExecutablePath,CreationDate,CommandLine
      Get-Process -Id <pid> | select Id,HandleCount,@{n='Threads';e={$_.Threads.Count}},CPU,PrivateMemorySize64
    2. Handle types. Please send the output of Sysinternals handle handle.exe -s -p <pid>, taken twice about 60 seconds apart.
    3. A short trace while it is growing:
      wpr -start CPU -start Handle -filemode
      (wait ~30 seconds)
      wpr -stop nuget-mcp-15132.etl
      
      Also, if you can, dotnet-dump collect -p <pid>. The dump may contain file paths or source URLs, so please share it privately.
    4. Whether the host is still sending requests. Please check for active Copilot agent conversations at that moment. If possible, include the MCP output log from VS Code (Output panel → MCP: nuget) for that time window.
    5. Your environment. Please include any authenticated or private feeds, credential providers installed, and whether the solution uses MSBuild SDKs from NuGet (for example Microsoft.Build.Traversal) or workloads.

    Setting DOTNET_CLI_TELEMETRY_OPTOUT=1 for the server and checking whether growth still occurs would also help isolate the telemetry exporter.

  9. added
    WaitingForCustomer
    and removed on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Product:MCPServerTenet:PerformanceType:BugWaitingForCustomer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions