[zeromq-dev] Python / Zmq / Gevent

Paul Colomiets paul at colomiets.name
Thu Apr 19 21:51:59 CEST 2012


Hi Antonio,

On Thu, Apr 19, 2012 at 6:42 PM, Antonio Teixeira
<eagle.antonio at gmail.com> wrote:
> Hello Once Again :)
>
> I have deployed the following scenario :
>
> REQ (ipc://IPC/SOCKET- Connect - Using Multiple Threads/ Greenlets) -> (IPC
> ROUTER - Bind ipc://IPC/SOCKET) -> (DEALER TCP - Connect:127.0.0.1:2222)
> -> (Router TCP Bind :127.0.0.1:2222) - (IPC DEALER - Bind ipc://IPC/SOCKET2)
> -> REP ( Using Multiple Threads/ Greenlets Connect - ipc://IPC/SOCKET2)
>
> A Thread make the place of the device with a simple:
>
> data = recv()
> send(data)
>
> All code based on this :
> https://github.com/zeromq/pyzmq/blob/master/examples/gevent/reqrep.py
>
> On The REP Side 10 Greenlets
> On The REQ Side 1 Greenlet
>
> 100 Tasks ( A simple print and return)
>
> Everything Works Well.
>
> The same as above
>
> On The REP Side 10 Greenlets
> On The REQ Side 5 Greenlet
>
> It works well until ...
> Did Not Receive A Response The Destination Server Is Unreachable.
> Ok so Pieter and other at the mailing list pointed me that if the socket
> disconnects we clear the socket.
>
> self.workerSocket.setsockopt(zmq.LINGER, 0)
> self.workerSocket.close()
>
> And make a new one , well this still doesn't work.
> The REP Side is still online and available since i can use another machine
> with the "client software ( the REP Part) " and it works perfectly until the
> same happens.
>
> So to "The Guide" we go.
> Set Linger 0 to ensure everything is dropped , checked OK
> Close the socket and started a new one , checked OK
> Use identity in case stuff gets funky , so one UUID for each worker inside
> the client set before we connect to the IPC , checked OK
>
> So after all this the problem remains but when I'm terminating the
> client(SIGKILL) i can see that "some pending messages" get dumped and sent
> to the Server ( REQ Part) maybe something jams the device or i have a
> misconfig ?
>

You seem to use single REQ socket for multiple requestors, right?
Either use XREQ socket or create a socket per greenlet.

-- 
Paul



More information about the zeromq-dev mailing list