Skip to content
Myr

Close and then release the connection

Before adoption: this commit came in with the history the project adopted, so no landing records it.

urllib3 closes the underlying connection when we call urllib3.Response.close but does not release it back to the connection pool. This can cause issues when users have a blocking connection pool configured and connections are not readily returned to the pool. Since the underlying connection is closed, we should be able to safely return the connection to the connection pool, so to fix this issue we merely need to not return after closing the response. Closes gh-3461

authored by Ian Cordasco · committed by Ian Cordasco · parent f40764c · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:requests/models.py+1 added-1 removed
866 unmodified lines
867868 *Note: Should not normally need to be called explicitly.*869 """870 if not self._content_consumed:871 return self.raw.close()871 self.raw.close()872873 return self.raw.release_conn()