MCP session disposal throws ObjectDisposedException by accessing an expired HttpContext
Maintainer antworten meist innerhalb von 2 Tagen
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Start with McpServer.cs around line 129 and trace RunSessionHandler through its finally block. Review the existing EndedSession_RemovesLocationSubscription test and add regression coverage for disposal after the initialization request ends. Done means teardown releases subscriptions and applicable legacy admission state without throwing an ObjectDisposedException; pull request #250 is already open against this issue.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Description
Observed with Cosmos DB Shell 1.1.280-preview on macOS through a VS Code MCP client. The account connection succeeded; session cleanup subsequently logged:
Error disposing session.
System.ObjectDisposedException: IFeatureCollection has been disposed.
Object name: 'Collection'.
at Microsoft.AspNetCore.Http.DefaultHttpRequest.get_Path()
at Azure.Data.Cosmos.Shell.Mcp.McpServer...
ConfigureHttpTransport... in McpServer.cs:line 137
at ModelContextProtocol.AspNetCore.StreamableHttpSession.DisposeAsync()
at ModelContextProtocol.AspNetCore.StatefulSessionManager.DisposeSessionAsync(...)
The unsafe access remains in McpServer.cs on main. The updated local main and origin/main both pointed to 6875685c6a2670ffcf85cdecff13420eea3a0a9b when checked.
Cause
RunSessionHandler awaits RunSessionAsync, then its finally block accesses httpContext.Request.Path and potentially httpContext.RequestServices. The originating HTTP request can already be disposed when the longer-lived MCP session ends.
This also affects non-legacy stateful sessions: evaluating the "/sse" condition itself dereferences the disposed context.
Expected Behavior
Session teardown completes without accessing expired request state, while releasing subscriptions and applicable legacy admission state.
Suggested Fix
Capture the legacy-transport decision and required singleton services before awaiting the session. Use only those captured values during cleanup.
Regression Coverage
Exercise session disposal after the initialization HTTP request has ended. Assert both successful cleanup and absence of disposal exceptions.
The existing EndedSession_RemovesLocationSubscription test checks subscription removal, but that cleanup occurs before the failing outer finally; it therefore does not establish error-free teardown.
Scope
The observed failure is in session cleanup. It does not establish that preceding tool calls failed or that unrelated Azure deployment operations were affected.
- Vorherrschende Sprache
- C#
- Sterne
- 4
- Forks
- 7
- Ø Merge
- 1 T. 20 Std.
- Gemergte PRs (30 T.)
- 28
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Azure/CosmosDBShell
-
print cannot read items with numeric or hierarchical partition keysEvtl. vergeben @mkrueger hat das vor 1 Tag übernommen. Offenbug P0
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
Azure/CosmosDBShell#244 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
Azure/CosmosDBShell#240 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
automation P1
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 45/100
Azure/CosmosDBShell#178 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Lightweight headless CI distribution (no MCP, LSP, interactive UI)Evtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offenautomation P1
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
Azure/CosmosDBShell#175 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
agentic enhancement P0
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
Azure/CosmosDBShell#153 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in Azure/CosmosDBShell
Ähnliche Issues
-
:watch: Not Triaged async-task-programming/subsvc dotnet-csharp/svc
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
Python: Bug: AnnotationContent and StreamingAnnotationContent to_element writes CitationType.X, so annotations in a rendered chat history fail to parseEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offenpython triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
microsoft/semantic-kernel#14590 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
Maintainer antworten meist innerhalb von 1 Tag
-
Needs-Triage
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
PowerShell/PowerShell#28194 ·
Maintainer antworten meist innerhalb von 1 Tag
-
AI Projects Client customer-reported needs-team-attention question Service Attention
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Azure/azure-sdk-for-net#63804 · 3 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag