csharp-sdk/tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Joel Forsyth 4d011995d1 Release SSE response stream reference when GET request ends
StreamableHttpServerTransport held a reference to the Kestrel SSE
response stream via _httpSseWriter for the entire session lifetime.
Since the transport is only disposed when the session itself is disposed
(via explicit DELETE or idle timeout), clients that disconnect without
sending DELETE — which is typical for long-lived SSE connections — left
the response stream pinned for the remainder of the idle timeout window.

Because the Kestrel HTTP connection (and its associated memory pool
buffers, Pipe readers/writers, socket send/receive buffers) is only
collectible once all references to the response stream are released,
this pinned ~20MiB of unmanaged memory per disconnected session until
cleanup. Under steady connect/disconnect churn (e.g., IDE availability
probes) this accumulated into sustained memory growth that eventually
OOMKilled the container.

Fix: release _httpSseWriter from within HandleGetRequestAsync's finally
block so the reference is dropped as soon as the GET request exits, not
just when the session is disposed. SendMessageAsync handles the
now-nullable field via the existing _getHttpResponseCompleted gate, and
any server-to-client messages sent after disconnect are still captured
by the event store writer for replay via Last-Event-ID.

Add a unit test that verifies _httpSseWriter is null once
HandleGetRequestAsync returns.

Relates to #766.
2026-06-05 16:52:49 -07:00
..
Common/Utils Bring up to 0.1.13 conformance (#1254) 2026-02-10 08:33:52 -08:00
ModelContextProtocol.Analyzers.Tests Fix source generator diagnostic locations for incremental caching (#1153) 2026-01-19 09:37:15 -05:00
ModelContextProtocol.AotCompatibility.TestApp Add AOT compatibility publish test (#1246) 2026-02-09 22:00:12 +02:00
ModelContextProtocol.AspNetCore.Tests feat: Add Enterprise Managed Authorization (SEP-990) support (#1305) 2026-06-03 16:34:59 -07:00
ModelContextProtocol.ConformanceClient Fix process crash when testing Stderr (#1449) 2026-04-06 11:29:00 -07:00
ModelContextProtocol.ConformanceServer Add 3-arg RequestContext constructor and obsolete 2-arg to eliminate null-forgiving operator usage (#1462) 2026-03-27 12:33:23 -07:00
ModelContextProtocol.ExperimentalApiRegressionTest Hide experimental types from external source generators using internal property pattern (#1301) 2026-02-19 07:27:30 -08:00
ModelContextProtocol.TestOAuthServer feat: Add Enterprise Managed Authorization (SEP-990) support (#1305) 2026-06-03 16:34:59 -07:00
ModelContextProtocol.Tests Release SSE response stream reference when GET request ends 2026-06-05 16:52:49 -07:00
ModelContextProtocol.TestServer Add 3-arg RequestContext constructor and obsolete 2-arg to eliminate null-forgiving operator usage (#1462) 2026-03-27 12:33:23 -07:00
ModelContextProtocol.TestSseServer Add stateless doc, prefer stateless mode and disable legacy SSE by default (#1468) 2026-03-27 13:56:16 -07:00
Directory.Build.props Add stateless doc, prefer stateless mode and disable legacy SSE by default (#1468) 2026-03-27 13:56:16 -07:00