I have a frontend WSGI server that connects to backend servers using
Thrift. If I use monkey.patch_socket() I get assertion errors whenever
the frontend performs a Thrift RPC call:
AssertionError: This event is already used by another greenlet:
(<Greenlet at 0x18524f8: <bound method SilentWSGIServer.handle of
<SilentWSGIServer at 0x537e10 fileno=6
address=0.0.0.0:57005>>(<http_request _obj=0x164bc10 "GET
/series?keys=22)>, timeout('timed out',))
(SilentWSGIServer is a subclass of gevent.wsgi.WSGIServer, but both
have the same issue)
If I don't monkey patch socket, I do not get these errors and
everything works fine. My question is, what does this assertion
indicate? Is it something I'm doing? Some issue in Thrift?
Thanks,
Alec
--
I think I see the problem. The problem is that you are wrong.
Unlike 0.12.2, socket in the current dev version does not allow more
than one greenlet to recv or send. (It's OK to receive in one greenlet
and send in another). This helped to fix issue #26
(http://code.google.com/p/gevent/issues/detail?id=26).
This might break compatibility with stdlib sockets.
On the other hand, it seems that if you have two or more
receivers(senders) on one socket most likely it's a logic error.
Whether it's caused by your code or by Thrift is hard to guess without
knowing the details. Can you post a minimal example that reproduces
the error? Also, please post the complete tracebacks.
Cheers,
Denis.