You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stale cache refresh fails on Windows with PyPy #497
On PyPy on Windows, refreshing a stale response in a file-backed separate-body cache can fail because the old body file remains open. In pip this leaves new headers beside the old body (pypa/pip#14431). urllib3 2.8 exposes the mismatch by enforcing the new Content-Length and raising IncompleteRead when the old body is shorter; it does not cause the open-file bug.
CacheController opens the body during cache lookup but does not close the response when cached_request() rejects it, conditional_headers() reads its validators, or deserialization fails. A stale request can leave two handles open.
Expected: close discarded separate-body responses while leaving returned cache hits and in-memory cached responses open.
Related: #302 assumed the response would close the file. #343 addresses conditional_headers() but misses the other discard paths.
Activity
woodruffw commentedon Nov 16, 2026
Thanks, I merged #498 and part of #502 and I've shipped a new CacheControl release.
notatallshaw commentedon Nov 16, 2026
Speedy, thanks!