MCP session disposal throws ObjectDisposedException by accessing an expired HttpContext
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C#
- Star
- 4
- Fork
- 7
- Merge trung bình
- 2 ngày 13 phút
- Pull request đã merge (30 ngày)
- 30
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure/CosmosDBShell
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
Azure/CosmosDBShell#251 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Azure/CosmosDBShell#240 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
automation P1
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
Azure/CosmosDBShell#178 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Lightweight headless CI distribution (no MCP, LSP, interactive UI)Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởautomation P1
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Azure/CosmosDBShell#175 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
agentic enhancement P0
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Azure/CosmosDBShell#153 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của Azure/CosmosDBShell
Issue tương tự
-
area-signalr
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
dotnet/aspnetcore#69842 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug needs-triage
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 78/100
microsoft/microsoft-ui-reactor#1373 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Client customer-reported KeyVault needs-team-attention question Service Attention
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Azure/azure-sdk-for-net#63861 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
:watch: Not Triaged dotnet-csharp/svc fundamentals/subsvc
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày