fix: response leak when using caching adapter and streaming#344
fix: response leak when using caching adapter and streaming#344frostming merged 1 commit intopsf:masterfrom
Conversation
| response._update_chunk_length = types.MethodType( # type: ignore[method-assign] | ||
| _update_chunk_length, response |
There was a problem hiding this comment.
When you assign a method like this, you're creating a circular reference to self, because when you normally call response._update_chunk_length, it actually creates the bound method on-the-fly, it's not set there all the time.
This SO response helped me understand it: https://stackoverflow.com/a/26158130
frostming
left a comment
There was a problem hiding this comment.
Good catch and fix. I would like to accept this. And I will wait for the inputs from @woodruffw
woodruffw
left a comment
There was a problem hiding this comment.
Thanks, makes sense to me as well. I appreciate the additional unit test!
|
Hi, when can we expect this being released to pypi? |
Assuming nothing else comes up, I'll cut a release in the next day or so. |
|
@woodruffw sorry for bothering, but any update? |
|
Sorry for the delay; I've opened #350 to prep the release. |
|
This has been released with v0.14.2. Thanks for the ping @racinmat! |
Currently, this library breaks
requestsbehavior, where the finalizer will close response if user forges to call close. Use WeakRefs to prevent this.