[zeromq-dev] Fail unroutable working only in simple case

Michal Laskowski lsk12 at o2.pl
Tue Sep 18 02:06:14 CEST 2012

this my first message, so maybe a bit of introduction about myself and my project. I am Michal, C++/Java developer from Poland.
I am building a small library based on ZMQ, that will allow for fast and reliable communication. 
I really like ZMQ, it is working great, but now I got a major problem. In my library I have a broker built on pair of ROUTER-ROUTER sockets. When my frontend sends a request to broker, there are some cases that if message is unroutable, frontend should be informed about that and message should be dropped. Unroutable means no connected endpoints at this time.

So for that I have found ZMQ_FAIL_UNROUTABLE option. And it is working correctly for a simple case when first message is unroutable. But when we start an endpoint, send message from frontend(which is delivered to endpoint), then close(terminate) endpoint and try to send message once again we will not get EHOSTUNREACH. For sender it seems like everything is correct.
I got the same behaviour in 3.3 version, with ZMQ_ROUTER_BEHAVIOUR.

From what I have seen in source, check for Unroutable is made by checking if we have a pipe registered with given backend socket's name. I was assuming that after disconnection pipe should be removed from the list, but probably that is not happening. 

Also what I have noticed is that I am getting EAGAIN even when succesfully sending message from router to router.

I am using ZMQ 3.2 version, on Ubuntu 12.04 32 bit.

So, am I doing sth not correctly, or just ZMQ_FAIL_UNROUTABLE just does not work the way I want? I really would like to use existing TCP hearbeats in keep-alive connection, so I don't have to do it myself just to check if endpoint is alive.

Best regards,
Michal Laskowski


More information about the zeromq-dev mailing list