Skip to content

TCP connections remain in CLOSE_WAIT state after client disconnection in SSE mode #378

@hty690

Description

@hty690

Bug description
When clients terminate SSE connections with the Java MCP server, the underlying TCP connections remain in CLOSE_WAIT state, while the client side stays in FIN_WAIT_2. This can lead to resource leaks, especially in scenarios where clients cannot properly send RST signals (e.g., when using customized user-space network stacks).

Image

Environment
java version: 17
sdk version: 0.10.0
spring-ai.version: 1.0.0

Steps to reproduce

  1. setup a plain spring-ai mcp server, listen on localhost:8888/sse
  2. use inspector to call 127.0.0.1:8888/sse
  3. use inspector to list tool/call tools/...
  4. disconnect the connection and use netstat -anp|grep 8888

Expected behavior
All TCP connections should be closed properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions