Open simomo opened 9 years ago
Hi,
I just hacked the basic_class.py
, I changed the line 203
to
if func:
gevent.spawn(func, msg)
Hope this can fix my issue :)
Yup, any "blocking" (loosely defined) function on a consumer should be in another greenlet. There is a GeventPoolTransport to assist with this, though I have not used that in some time and it may need some work. You're likely better off spawning a greenlet on the consumer in your own code.
Hi, Sorry for the interruption. I found my server can't receive data/msg from rabbitmq server for several minutes and then it recovered itself.
When I look into the log, I found that one consumer were trying to send data to mobile app through
gevent.socket.sendall
function, this function blocked.... Several minutes later, this sendall function raise the exceptionand the same time , this socket's recv function raised the
Connection timed out
errorSo I guess the tcp connection was closed before calling the
sendall
function, andsendall
function was blocked until time out error. When it was blocked, all the other consumers couldn't receive the data from Rabbitmq server. To fix this bug, I'm planning to add the SO_SNDTIMEO option for thesendall
function._But on haigha's side, could I do something to avoid one blocked consumer blocking the entire Rabbitmq connection? How about running every consumer in a new greenlet or running all consumers on a greenlets pool?_
Any comments would be helpful, many thanks!