Skip to content

Memory regression in HotChocolate 15.1.14+ and 16.x after CVE-2026-40324 parser fix - cache controls don't prevent leak #9814

Description

@bn-lroumiantseva

Product

Hot Chocolate

Version

15.1.14+ and 16.x

Link to minimal reproduction

Cannot provide - issue occurs in proprietary enterprise application under sustained load. Extensive version comparison testing (6 different HC versions) and evidence provided below.

Steps to reproduce

  1. Deploy ASP.NET Core 10.0 GraphQL API with HotChocolate 15.1.14+ or 16.x
  2. Configure GraphQL server with:
    • Projections, Filtering, Sorting enabled
    • RegisterDbContextFactory for EF Core integration
    • In HC 16: Set OperationDocumentCacheSize=25, PreparedOperationCacheSize=16
  3. Execute GraphQL queries at sustained rate (~68 queries/minute)
  4. Monitor memory usage over 20+ minutes

Note: Issue is LOAD-DEPENDENT. Does not manifest in low-traffic environments.

  • Dev with HC 16.0.11 (low load): Stable at 225-230 MiB ✅
  • QA with HC 16.0.11 (68 queries/min): Grows to 575-588 MiB ❌
  • QA with HC 15.1.14/15/16 (68 queries/min): Grows to 432-539 MiB ❌
  • Production with HC 15.1.10 (1,201 queries/min - 34x higher): Stable at 280 MiB ✅

The leak appears only in versions 15.1.14+ and only under sustained query load.

What is expected?

Memory should remain stable similar to HotChocolate 15.1.10 behavior observed in QA:

  • QA environment with HC 15.1.10: ~300-330 MiB stable over 11 hours

For context: Production runs HC 15.1.10 at 1,201 queries/min (34x higher than QA's
68 queries/min), indicating the version handles high load well, though we don't have
production memory metrics to share.

Cache size controls in HC 16 should bound memory growth from query plan caching.

What is actually happening?

Memory grows continuously and never stabilizes in versions 15.1.14+ and 16.x:

QA Environment (68 queries/min, 20 minutes):

  • HC 15.1.10: 300-330 MiB stable ✅
  • HC 15.1.14: 500+ MiB growing ❌
  • HC 15.1.15: 528-539 MiB growing ❌
  • HC 15.1.16: 432-491 MiB growing ❌
  • HC 16.0.11 (cache 100/50): 575-588 MiB growing ❌
  • HC 16.0.11 (cache 25/16 minimum): 463-488 MiB @ 5min, still growing ❌

Even with minimum allowed cache sizes (PreparedOperationCacheSize=16,
OperationDocumentCacheSize=25), memory leak persists. This proves cache
controls don't prevent the issue.

Graph shows continuous upward trajectory - never plateaus.

Relevant log output

Additional context

Root Cause Hypothesis:
The MaxAllowedRecursionDepth tracking added in CVE-2026-40324 fix (v15.1.14)
appears to accumulate memory overhead outside of cache configuration.
The leak:

  • Manifests under sustained query load (not in low-traffic scenarios)
  • Is NOT bounded by OperationDocumentCacheSize or PreparedOperationCacheSize
  • Accumulates proportionally to query execution rate
  • Requires ~2x memory limits compared to 15.1.10

We have another service using HC 15.1.16 and doesn't have leak:
It's stable at 256-363 MiB. Differences:

  • Different query patterns/complexity
  • Lower execution rate
  • Suggests leak is query-pattern or load-pattern specific

Impact:
Cannot upgrade from 15.1.10 to patch CVE-2026-40324 (Critical, CVSS 9.1)
without additional memory allocation (not sure even how much: it seems doubling is not enough).
Need either:

  1. Fix for memory regression in 15.1.14+/16.x
  2. Guidance on additional configuration to mitigate
  3. Confirmation this is expected and memory limits should be 2x/...

Configuration:
.AddGraphQLServer()
.AddMutationType()
.RegisterDbContextFactory()
.AddProjections()
.AddFiltering()
.AddSorting()
.ModifyRequestOptions(opt => opt.ExecutionTimeout = TimeSpan.FromSeconds(30))
.ModifyOptions(options => {
options.OperationDocumentCacheSize = 25;
options.PreparedOperationCacheSize = 16;
});

Framework: .NET 10.0
Packages: HotChocolate.AspNetCore, HotChocolate.Data.EntityFramework, HotChocolate.Types

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions