Skip to content

fix: terminate active streamable http sessions on shutdown#2362

Open
raashish1601 wants to merge 1 commit intomodelcontextprotocol:mainfrom
raashish1601:contributor-12/python-sdk-2150
Open

fix: terminate active streamable http sessions on shutdown#2362
raashish1601 wants to merge 1 commit intomodelcontextprotocol:mainfrom
raashish1601:contributor-12/python-sdk-2150

Conversation

@raashish1601
Copy link
Copy Markdown

Summary

  • terminate active stateful streamable HTTP transports before cancelling the session-manager task group during shutdown
  • keep the manager's session registry consistent while transports are being closed
  • add a regression that keeps one stateful session alive and verifies shutdown awaits transport termination

Fixes #2150.

Testing

  • python -m pytest tests/server/test_streamable_http_manager.py -k 'test_run_terminates_active_stateful_sessions_on_shutdown or test_stateful_session_cleanup_on_graceful_exit'
  • python -m ruff check src/mcp/server/streamable_http_manager.py tests/server/test_streamable_http_manager.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Active Streamable HTTP sessions are not terminated during shutdown

1 participant