Close unclosed MemoryObjectReceiveStream in TestClient#2693
Close unclosed MemoryObjectReceiveStream in TestClient#2693Kludex merged 1 commit intoKludex:masterfrom
MemoryObjectReceiveStream in TestClient#2693Conversation
|
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 TestClientMemoryObjectReceiveStream 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 Kludex/starlette#2693.
Resolve Unclosed Memory Stream Object during tests Kludex/starlette#2693.
|
@alvindera97 if the issue is related to |
|
I'm still seeing this error when testing fastapi using the following package versions:
|
|
If you read this PR, I mention this in the beginning. |
Summary
TestClientisn't closingstream_receive: StreamObjectStreamcorrectly during shutdown. This has been confirmed by multiple people as part of discussion #2603. @markwaddle has identified that the issue is due tostream_receivenot being disposed of correctly in the shutdown function. Addingstream_receiveto the shutdown function's context manager resolved the issue as confirmed by myself and others in the discussion.Checklist