Problem
The MCP HTTP suite intermittently logs:
ERROR: Cannot schedule tasks on an EventLoop that has already shut down. This will be upgraded to a forced crash in future SwiftNIO versions.
The warning appears around stopDrainsAdmittedHandlerBeforeClosingItsSession. It does not fail the current test, but SwiftNIO explicitly says it will become a crash.
Evidence
- Clean detached PR checkpoint
22874f3: reproduced in 1 of 3 full CodexReviewMCPHTTPServerTests runs; all 27 tests otherwise passed.
- Current Wave 3B replacement worktree: reproduced in 2 of 3 full MCP runs; all tests otherwise passed.
- Five isolated runs of
stopDrainsAdmittedHandlerBeforeClosingItsSession did not reproduce, so this is suite-order/lifecycle timing rather than a deterministic assertion failure.
Required investigation
Trace NIO handler response/stream completion tasks and event-loop callbacks relative to listener/session close and shutdownGracefully(). The MCP lifecycle owner must await every Task that can call eventLoop.execute/write after shutdown. Do not suppress the warning or add delays.
Acceptance
- No scheduling occurs after event-loop shutdown.
- Repeated full MCP suite and full package runs emit no warning.
- Admission close -> handler/response flush drain -> session/channel close -> event-loop shutdown remains explicit.
- Deterministic task/flush ownership tests; no sleeps, polling, or warning filtering.
Problem
The MCP HTTP suite intermittently logs:
The warning appears around
stopDrainsAdmittedHandlerBeforeClosingItsSession. It does not fail the current test, but SwiftNIO explicitly says it will become a crash.Evidence
22874f3: reproduced in 1 of 3 fullCodexReviewMCPHTTPServerTestsruns; all 27 tests otherwise passed.stopDrainsAdmittedHandlerBeforeClosingItsSessiondid not reproduce, so this is suite-order/lifecycle timing rather than a deterministic assertion failure.Required investigation
Trace NIO handler response/stream completion tasks and event-loop callbacks relative to listener/session close and
shutdownGracefully(). The MCP lifecycle owner must await every Task that can calleventLoop.execute/write after shutdown. Do not suppress the warning or add delays.Acceptance