-
-
Notifications
You must be signed in to change notification settings - Fork 931
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
Close unclosed MemoryObjectReceiveStream
in TestClient
#2693
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
We have an ignore of resource warning on the pyproject. Is this PR enough to remove that? |
@Kludex Any idea when this will be merged? We are currently working around this issue by pinning an older version of anyio. |
It would be cool to get my question replied... |
I removed the ignore filter and re-ran the tests and can see 7 tests still fail because of this warning. So this only prevents the issue from propagating to people who are using TestClient. @Kludex If you would like these issues resolved first before the PR is merged, let me know and I can take a look this evening. |
Ideally, it would be cool to solve everything that was introduced by the bump of anyio on the project before merging this. But... It's not a blocker... |
No worries, I will take a look when I get back on my computer. |
Thanks. |
MemoryObjectReceiveStream
on TestClient
MemoryObjectReceiveStream
on TestClient
MemoryObjectReceiveStream
in TestClient
I'll make a release with this PR, but I think this will lower the motivation to find out why we have more unclosed memory objects... 😢 |
I had more warnings by a factor of about 4X... Edit: |
Which version were you running before and after? Can you provide more details about the warning numbers. |
Updating So updating to the latest version |
Resolve Unclosed Memory Stream Object during tests encode/starlette#2693.
Resolve Unclosed Memory Stream Object during tests encode/starlette#2693.
@alvindera97 if the issue is related to |
Summary
TestClient
isn't closingstream_receive: StreamObjectStream
correctly during shutdown. This has been confirmed by multiple people as part of discussion #2603. @markwaddle has identified that the issue is due tostream_receive
not being disposed of correctly in the shutdown function. Addingstream_receive
to the shutdown function's context manager resolved the issue as confirmed by myself and others in the discussion.Checklist