skshetry / webdav4

WebDAV client library with a fsspec based filesystem and a CLI.
https://skshetry.github.io/webdav4
MIT License
61 stars 17 forks source link

Leaking connections if data was never read #105

Closed pauleikis closed 2 years ago

pauleikis commented 2 years ago

The line below is never invoked if there were no reads on the file object. This causes connection pool saturation and eventually timeouts. https://github.com/skshetry/webdav4/blob/a5ac69eb59405444958b13c148b24a1c74bb8186/src/webdav4/stream.py#L89

This gist demonstrates the issue: https://gist.github.com/pauleikis/a9247f1e8fdbfb70c756cb89a3fd49e4

skshetry commented 2 years ago

Thanks @pauleikis. What we probably need to do is, add response.close() on finally as well: https://github.com/skshetry/webdav4/blob/a5ac69eb59405444958b13c148b24a1c74bb8186/src/webdav4/stream.py#L95-L96

pauleikis commented 2 years ago

Yes. I believe that will work.

That's an easy fix, I will make PR as soon as I have time to write a proper test.

skshetry commented 2 years ago

Fixed by #106 and released in v0.9.6.