The problem seems to be a result of gevent.socket
being non-blocking, meaning that any socket.recv_bytes(X)
call will throw that error if X
bytes are not immediately available on the socket. Specifically, the gevent.socket
is designed to not block the socket, ever.
The problem with multiprocessing
arises because it uses the stdlib socket
module and expects it to be blocking, while after you've monkey.patch_all()
'd, the socket
module has been replaced, and multiprocessing.connection
is not designed to deal with the new asynchronous behaviour.
You can tell monkey
not to patch the socket
, but it means that anything that was leveraging asynchronous sockets in your application may incur some loss of performance due to this.
To do this call patch_all
with socket=False
: patch_all(socket=False)
.
This is not an ideal solution, as you pretty much lose much of the benefit you would have gained from using gevent
in the first place.