Per the code comment: requests ~(or apparently maybe urllib3)~ only retries when a valid HTTP response has a particular status code, but it doesn't handle if the actual connection is broken - specifically we're getting "incomplete reads" from time to time.
Since I don't have a good way of actively testing this, I've started with just a straight forward "lets retry once" which will hopefully be enough to smooth out the failures; I've also done this by refactoring the existing s3_session method since it was only being used in one place anyway so it doesn't feel worth adding a whole other wrapper method
Per the code comment:
requests
~(or apparently maybeurllib3
)~ only retries when a valid HTTP response has a particular status code, but it doesn't handle if the actual connection is broken - specifically we're getting "incomplete reads" from time to time.Since I don't have a good way of actively testing this, I've started with just a straight forward "lets retry once" which will hopefully be enough to smooth out the failures; I've also done this by refactoring the existing
s3_session
method since it was only being used in one place anyway so it doesn't feel worth adding a whole other wrapper methodAlso see https://github.com/psf/requests/issues/4568