pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/modelcontextprotocol/python-sdk/pull/2668

ns-9111c292f95f2fb0.css" /> fix(streamable-http): downgrade stateless 'Terminating session: None' log by adityasingh2400 · Pull Request #2668 · modelcontextprotocol/python-sdk · GitHub
Skip to content

fix(streamable-http): downgrade stateless 'Terminating session: None' log#2668

Open
adityasingh2400 wants to merge 1 commit into
modelcontextprotocol:mainfrom
adityasingh2400:adityasingh2400/stateless-log-clarity
Open

fix(streamable-http): downgrade stateless 'Terminating session: None' log#2668
adityasingh2400 wants to merge 1 commit into
modelcontextprotocol:mainfrom
adityasingh2400:adityasingh2400/stateless-log-clarity

Conversation

@adityasingh2400
Copy link
Copy Markdown

Closes #2329.

In stateless mode, every request logged INFO: Terminating session: None because the transport had no session id to print. The repeated noise made real terminations hard to find and confused users into thinking their connection was failing. The cleanup itself is correct and unchanged, only the log line changes.

This PR branches on mcp_session_id in StreamableHTTPServerTransport.terminate():

  • Stateful path keeps the existing INFO log with the session id.
  • Stateless path logs DEBUG: Stateless request completed, cleaning up transport, which is more accurate (the request is done, not a session being torn down) and lower volume.

Two caplog tests are added to tests/shared/test_streamable_http.py to cover both branches and prevent regression.

This replaces the prior community PR #2357 by @BlocksecPHD, which proposed the same approach and was reviewed positively by another community member but has had no activity since April. Happy to defer or close in favor of #2357 if a maintainer would prefer to revive that branch, the credit belongs there.

… log

In stateless mode every request created a transport with mcp_session_id=None
and terminated it on completion, producing
'INFO: Terminating session: None' on every request. The repeated noise made
real session terminations hard to find and confused users into thinking
their connection was dropping.

Branch on mcp_session_id in terminate(): keep the existing INFO log for
stateful session terminations, and switch the stateless path to a DEBUG
log with a clearer message ("Stateless request completed, cleaning up
transport"). Adds two caplog tests covering both branches.

Closes modelcontextprotocol#2329.
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.

Improve log clarity for "Terminating session: None" in stateless mode

1 participant

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy