requests / SSL blocks forever?

Nagy László Zsolt gandalf at shopzeus.com
Mon Jan 15 13:34:13 EST 2018


> (a) are you setting daemon=True on the thread?
> (b) are you setting a timeout on the requests call?
Hmm setting the timeout might not be the solution. This is from the docs
of the requests module:
>
> Note
>
> |timeout| is not a time limit on the entire response download; rather,
> an exception is raised if the server has not issued a response for
> |timeout| seconds (more precisely, if no bytes have been received on
> the underlying socket for |timeout| seconds). If no timeout is
> specified explicitly, requests do not time out.
>
In other words: if the server starts to send the response, but then
stops sending it (without closing the connection), then this will block
forever anyway.

There seems to be no protection against this scenario, at least not with
the requests module.




More information about the Python-list mailing list