Skip to content

Fix concurrent first requests to one schema failing with HTTP 500 - #10525

Merged
glen-84 merged 2 commits into
mainfrom
gai/share-executor-session-across-proxies
Oct 9, 2026
Merged

glen-84 merged 2 commits into
mainfrom
gai/share-executor-session-across-proxies

Conversation

@glen-84

@glen-84 glen-84 commented Oct 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Every HTTP proxy for a schema now gets the same ExecutorSession, registered as a singleton in the executor's schema services for Core and Fusion. Proxies no longer store the session in executor.Features, an unsynchronized collection shared by all endpoints of a schema. Concurrent first requests to two endpoints, such as MapGraphQLHttp and MapGraphQLSchema, no longer fail with Operations that change non-concurrent collections must have exclusive access or Feature 'HotChocolate.AspNetCore.ExecutorSession' is not present, and executor swaps no longer write to the new executor from every proxy at once.
  • The MCP proxy resolves its StreamableHttpHandler from schema services, and after a swap it notifies the previous executor's MCP sessions by reading their dictionary from that executor directly. McpExecutorSession is removed.

Test plan

  • New HttpRequestExecutorProxyTests: proxies that share an executor return the same session, and 2 or 16 proxies starting together on each of 20 fresh executors return one session per executor. All three cases fail without the fix, and the concurrent case also reproduces the reported errors.
  • AspNetCore.Tests, Adapters.Mcp.Tests (including ListTools_AfterSchemaUpdate_ReturnsUpdatedTools for the swap notification), Adapters.OpenApi.Tests, Fusion.AspNetCore.Tests, and both Azure Functions test projects pass on net10.0.

Closes #10480

Copilot AI lite review requested due to automatic review settings October 9, 2026 14:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved issues were identified that would block approval.

0 open findings

What changed in this PR

Fixes concurrent first-request failures by moving per-executor sessions into schema services and removing unsynchronized feature collection writes.

Changes:

  • Registers ExecutorSession as a schema-scoped singleton for Core and Fusion.
  • Resolves HTTP and MCP handlers from schema services.
  • Adds concurrency tests and removes McpExecutorSession.
File Description
src/​HotChocolate/​Fusion/​src/​Fusion.AspNetCore/​DependencyInjection/​FusionServerServiceCollectionExtensions.cs Updated as part of this pull request.
src/​HotChocolate/​AspNetCore/​test/​AspNetCore.Tests/​HttpRequestExecutorProxyTests.cs Updated as part of this pull request.
src/​HotChocolate/​AspNetCore/​src/​AspNetCore/​Extensions/​HotChocolateAspNetCoreServiceCollectionExtensions.cs Updated as part of this pull request.
src/​HotChocolate/​AspNetCore/​src/​AspNetCore.Pipeline/​HttpRequestExecutorProxy.cs Updated as part of this pull request.
src/​HotChocolate/​Adapters/​src/​Adapters.Mcp.Core/​Proxies/​StreamableHttpHandlerProxy.cs Updated as part of this pull request.
src/​HotChocolate/​Adapters/​src/​Adapters.Mcp.Core/​Proxies/​McpRequestExecutorProxy.cs Updated as part of this pull request.
src/​HotChocolate/​Adapters/​src/​Adapters.Mcp.Core/​Proxies/​McpExecutorSession.cs Updated as part of this pull request.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Patch coverage

96.2% of changed lines covered (25/26)

File Covered Changed Patch %
…/src/Adapters.Mcp.Core/Proxies/StreamableHttpHandlerProxy.cs 10 11 90.9% 🟡
…/src/Adapters.Mcp.Core/Proxies/McpRequestExecutorProxy.cs 6 6 100.0% 🟢
…/src/AspNetCore.Pipeline/HttpRequestExecutorProxy.cs 3 3 100.0% 🟢
…/HotChocolateAspNetCoreServiceCollectionExtensions.cs 3 3 100.0% 🟢
…/FusionServerServiceCollectionExtensions.cs 3 3 100.0% 🟢
Uncovered changed lines (JSON)
{
  "sha": "23564430fc8f44a1e47bfae695ffd3f820bbdd53",
  "files": [
    { "path": "src/HotChocolate/Adapters/src/Adapters.Mcp.Core/Proxies/StreamableHttpHandlerProxy.cs", "ranges": [[49, 49]] }
  ]
}

Project coverage: 58.6% (314246/536469 lines)

@glen-84
glen-84 merged commit 67c000b into main Oct 9, 2026
158 checks passed
@glen-84
glen-84 deleted the gai/share-executor-session-across-proxies branch October 9, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Concurrent first requests to MapGraphQLHttp and MapGraphQLSchema endpoints corrupt the executor's FeatureCollection

2 participants