Skip to content
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

Leaking STDIO client: Unclosed <MemoryObjectReceiveStream> #169

Open
EItanya opened this issue Jan 24, 2025 · 0 comments
Open

Leaking STDIO client: Unclosed <MemoryObjectReceiveStream> #169

EItanya opened this issue Jan 24, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@EItanya
Copy link

EItanya commented Jan 24, 2025

Describe the bug
A clear and concise description of what the bug is.

While running the MCP stdio client I noticed that my application was logging a warning from the anyio library, specifically related to unclosed streams.

When I dug in further I noticed that the stdio client does not close any of the streams after completing, see the following link.

This is as opposed to the sse_client which does close the streams.

Here is a slightly scrubbed more detailed error:

/home/user/src/microsoft/autogen/python/.venv/lib/python3.12/site-packages/anyio/streams/memory.py:183: ResourceWarning: Unclosed <MemoryObjectReceiveStream at 7f5394255fa0>
  warnings.warn(
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/home/user/src/microsoft/autogen/python/.venv/lib/python3.12/site-packages/anyio/streams/memory.py:313: ResourceWarning: Unclosed <MemoryObjectSendStream at 7f5394256270>
  warnings.warn(
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/home/user/src/microsoft/autogen/python/.venv/lib/python3.12/site-packages/anyio/streams/memory.py:183: ResourceWarning: Unclosed <MemoryObjectReceiveStream at 7f5394256de0>
  warnings.warn(
ResourceWarning: Enable tracemalloc to get the object allocation traceback

The context here is that I am trying to add support for MCP to microsoft/autogen but this is most likely a blocker.

To Reproduce

As mentioned, I am running this code from another project, but this should be easily reproducible with a small example, I will try to do that and update if I find anything.

Expected behavior

No warnings should be logged as these streams should be properly closed

Screenshots
If applicable, add screenshots to help explain your problem.

@dsp-ant dsp-ant added the bug Something isn't working label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants