faktory_worker_python
faktory_worker_python copied to clipboard
Fix apparent connection resets due to SSL socket errors
I kept running into connection resets when enabling TLS. The issue is explained here:
https://stackoverflow.com/questions/3187565/select-and-ssl-in-python
Another problem is, if you write 2048 bytes to the connection at the other end, the select() on your end returns. But if you then only read 1024 bytes from the SSL socket, it is possible that the SSL socket internally reads more data, and the next select() won't return even though there would be more data to read, possibly deadlocking the connection. This is because the raw socket, which is what select() is using, doesn't have any data since it's already in the SSL socket's buffers.