[zeromq-dev] [BUG] forever reconnect even after deleting the socket

Martin Sustrik sustrik at 250bpm.com
Wed Jan 19 09:59:44 CET 2011


Thijs,

> So far so good (though I think the reconnect interval should be
> augmented by exponential back-off, perhaps by splitting it in two
> options ZMQ_RECONNECT_IVL (the max) + ZMQ_RECONNECT_IVL_MIN ). A patch
> for this should be easy.

Yes. Makes sense. Feel free to submit a patch.

> The BUG:
>
> When I upgrade from 2.0.10 to the latest github version (
> zeromq-zeromq2-v2.1.0-35-ga249d15.tar.gz ) , the flood doesn't stop
> when I destroy the socket in my application. It keeps flooding forever
> which also leads to problems using the socket (timeouts etc). It seems
> the socket is not cleaned up correctly internally? I didnt have time
> yet to look into the problem in more detail.
>
> Extra descriptions:
> The socket appears to be still connected to the two servers. So about
> half of the requests succeed, where the other half timeout (to the
> down server). With tcpdump I can see non-stop (>100ms) reconnect
> attempts to the down server. I'm using XREQ from the client.
>
> I use the C++ interface and create a socket on the heap as such :
> m_tcp_sock = new socket_t([zmqcontext], ZMQ_XREQ);
> and delete it with a simple:
> delete m_tcp_sock;
>
> The only difference between the two versions of my application is
> which ZeroMQ version I use.

I believe this is due to the fact that there are still unsent messages 
in the client. Thus is tries to reconnect in order to sent them before 
exiting. You can exit immediately by setting ZMQ_LINGER to zero and 
closing the socket.

Martin



More information about the zeromq-dev mailing list