Skip to content

Close unclosed resources in the whole project #267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 13, 2025

Conversation

Kludex
Copy link
Member

@Kludex Kludex commented Mar 12, 2025

I'll be using this branch on PydanticAI. I can't add tests otherwise.

@Kludex Kludex changed the title Close resources Close streams in send_request Mar 12, 2025
Copy link
Contributor

@jerome3o-anthropic jerome3o-anthropic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thank you

return result_type.model_validate(response_or_error.result)
finally:
await response_stream.aclose()
await response_stream_reader.aclose()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we'd also like to delete the entry in self._response_streams also

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional - I can get this later if needed

@jerome3o-anthropic
Copy link
Contributor

Looks like there are a bunch of check failures. I'm not sure if these are even related though

@Kludex
Copy link
Member Author

Kludex commented Mar 12, 2025

I think it's from a change that I made yesterday, but unrelated to this PR. I think it was merged before the pipeline run? 🤔

@dsp-ant
Copy link
Member

dsp-ant commented Mar 12, 2025

This leaves one pytest error which might be legit

@@ -67,6 +67,9 @@ packages = ["src/mcp"]
include = ["src/mcp", "tests"]
venvPath = "."
venv = ".venv"
strict = [
"src/mcp/server/fastmcp/tools/base.py",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More should be added here.

@Kludex Kludex changed the title Close streams in send_request Close unclosed resources in the whole project Mar 13, 2025
@dsp-ant dsp-ant self-requested a review March 13, 2025 10:57
@dsp-ant dsp-ant merged commit 94d326d into modelcontextprotocol:main Mar 13, 2025
4 checks passed
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.

3 participants