Hi, Thanks for your fast answer.
I am aware it's edge triggered. In fact my little test program is a copy paste of gevent-zeromq (hence the little link on the top of the code ;)). I just simplified a bit the code to put everything in one file for the sack of my example. Note that I get the same error in my RPC project using gevent-zeromq without modifying it in any way. Cheers, On Tue, Nov 29, 2011 at 3:56 PM, MinRK <[email protected]> wrote: > > > On Tue, Nov 29, 2011 at 15:36, Francois-Xavier Bourlet <[email protected]> > wrote: >> >> Hello, >> >> First, let me tell you how much we appreciate and use ZMQ here, at >> dotCloud. We have developed an RPC protocol/system based on ZMQ. >> System for which we have an implementation in Python and nodejs. Our >> whole platform communication exclusively pass trough ZMQ. >> >> We never had major issue with ZMQ, and everything was working well >> until... I tried to implement a Python Gevent version of our RPC >> system. >> >> First, some versions details: >> - linux platform x86_64 >> - zmq >= 2.1.10 (git master as today >> 35df57cda6861cac31710ad2a10fae4c97c0e63c) >> - pyzmq == v2.1.7.1 >> - gevent == 0.13.6 >> - python 2.7 >> >> I have a tiny wrapper around PythonZMQ to make it compliant with >> gevent (coroutine) style programming. >> To integrate ZMQ into the gevent mainloop, I am using the fd returned >> by getsockopt(ZMQ_FD) and sometimes the fd is never notified that the >> state (getsockopt(ZMQ_EVENTS)) of the socket changed. Hence my code is >> waiting infinitely. >> >> Code speak better than words: http://pastebin.com/r3tiywzb >> This code will run a simple pong server (REP) and an *asynchronous* >> client (DEALER/XREQ). >> The client will keep sending messages, and keep receive messages >> without taking care of any orders. >> >> When I run this program on my machine, after few second, the receiver >> part of the client block while waiting for some event about new >> message available, but the event was never fired. When this case >> happen the program exit with the following message: "here we go, >> nobody told me about new messages!" >> > > > Are you aware that the ZMQ_FD is edge-triggered, and not level-triggered? > That means that you must process *all* available events when the event is > triggered. > > If ≥2 recvs are waiting, and you only process one, then the POLLIN event > will never fire again, hence an infinite wait. > You might check out Travis Cline's gevent-zeromq, which is meant to take > care of exactly this. > -MinRK > >> >> Thanks a lots for any help! >> >> Best Regards, >> -- >> François-Xavier Bourlet >> _______________________________________________ >> zeromq-dev mailing list >> [email protected] >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > -- François-Xavier Bourlet _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
