Implement cancellation in ReadableStream handling - #1
Conversation
Add cancellation support to the ReadableStream in the HTTP server.
|
I tested this patch against a deterministic MCP Streamable-HTTP repro and found one additional cancellation-propagation requirement. The proposed In this path, Adding close propagation in addition to this PR's guards fixed both the crash and the timer leak: cancel() {
cancelled = true;
_this.emit("close");
}(or an equivalent Proof: one MCP client connect+disconnect kills the unpatched server exactly at the SDK's 15,000ms keepalive. With the guards + close propagation, instrumentation shows |
Add cancellation support to the ReadableStream in the HTTP server.
Related issue mastra-ai/mastra#13899