Skip to content

Unit tests panic during shutdown #556

@fgrosse

Description

@fgrosse

Describe the bug

The test suite contains 16 panics that occur during test cleanup/shutdown, but they do not cause test failures. All tests pass despite these panics.

To Reproduce

go test -v ./mcp | grep "panic serving" | wc -l
      16

The panics occur in

c.logger.Error("stream context done", "error", ctx.Err())
and
c.logger.Error("error receiving message", "error", err)
when attempting to call a function on c.logger during HTTP connection cleanup.

The panics occur during cleanup in these streamable/SSE-related tests:

  • TestStreamableTransports
  • TestStreamableServerTransport
  • TestStreamableServerShutdown
  • TestServerTransportCleanup
  • TestStreamableGET
  • TestServerInitiatedSSE
  • TestClientReplay
  • TestStreamableStateless
  • TestTokenInfo

Why Tests Don't Fail

The panics happen in the HTTP server goroutines during connection cleanup after the test logic has completed. Go's HTTP server recovers from these panics internally and doesn't propagate them to the test framework.

Expected behavior

Tests should not contain any panics.

Logs

None

Additional context

None

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrelease blockerThis issue blocks the release milestone with which it is associated.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions