[zeromq-dev] Can't get ZMQ_REQ_RELAXED to run

Björn Kuhlbrodt bjoern.kuhlbrodt at gpsolar.com
Tue Nov 19 14:49:38 CET 2013

Hi Pieter

Thanks for the swift answer. I was silent because I tried to condense something meaningful, but it is not as easy.

The minimal version (based on test_req_relaxed.cpp) works fine. Only in the application the send command does not work. The application is a bit more complex:

I have two distinct parts of the software 
- a database connection done with 0MQ and its own zmq_ctx and 
- a central machine interface (CMI) which talks to - well - machines. This CMI creates a _second_ zmq_ctx, simply because it is not trivial to hand the same context to both parts.

-> Could that matter?

The CMI object passes that second ctx to a few machine interfaces (also c++ objects) which have a sending and a receiving thread. Each thread takes the ctx and opens a socket.

The sending socket/thread fails 90% the times I start the application and sits in zmq::mailbox_t::recv (also see my mail to Christian), the other 10% it works fine. I don't remember having done something different in these cases. It also works 100% if I set ZMQ_REQ_RELAXED to OFF.

One thing I also noticed: It seems to work if each machine interface object creates its own zmq_ctx. But that's so opposed to what you write....

Best regards

-----Original Message-----
From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Pieter Hintjens
Sent: Montag, 18. November 2013 09:33
To: ZeroMQ development list
Subject: Re: [zeromq-dev] Can't get ZMQ_REQ_RELAXED to run

Hi Björn,

The best thing when it comes to specific functionalities like this is a minimal test case that shows the problem.


On Mon, Nov 18, 2013 at 9:09 AM, Björn Kuhlbrodt <bjoern.kuhlbrodt at gpsolar.com> wrote:
> Hello
> I' trying to use the new (4.0.1) ZMQ_REQ_RELAXED in C++ with VS2010 (and the standard C-Binding from the 0MQ main site), but keep failing.
> What I have:
> One context with two ZMQ_REQ sockets in two different threads, one binds and answers to REQs, one connects and sends REQs. This runs fine and nice until one system crashes before answering a REQ - a known Problem of the REQ-REP.
> What I tried:
> I'm not too eager to kill the context to get the REQ-REP running again, because that would kill my other socket too. The new ZMQ_REQ_RELAXED came in very handy, just fit to solve the problem.
> BUT:
> Now the zmq_msg_send(...)-Method fails to return after a few packages (or even for the first packet) while the client is up and waiting for packages, yes even actively communicating with the server over the other socket. I tried ZMQ_REQ_CORRELATE on and off - doesn't make a change. Tried ZMQ_REQ_RELAXED off again - everything works (except in crash-case).
> So my question:
> Anyone here tried the ZMQ_REQ_RELAXED? Any idea? I'm willing to post code, but I'd need to extract the crucial parts, which could take a while.
> Regards
> Bjorn
> Dr. Björn Kuhlbrodt
> Senior Software Developer
> GP Inspect GmbH
> Tel: +49 89 750778 4729
> Fax: +49 89 750778 4710
> Mail: bjoern.kuhlbrodt at gpsolar.com
> GP Inspect GmbH | Hainbuchenring 9-11 | 82061 Neuried | Deutschland 
> Geschäftsführer | Christian Probst, Dr. Eric Rüland, Enis Ersü, Martin 
> Heinrich Amtsgericht München | HRB 173887
> A company of ISRA VISION Group
> ----------------------------------------------------------------------
> -------------------------------- This e-mail may contain material that 
> is confidential, privileged and for the sole use of the intended 
> recipient. Any review, reliance or distribution by others or 
> forwarding without express permission is strictly prohibited. If you 
> are not the intended recipient, please contact the sender and delete 
> all copies. GP Inspect GmbH, ISRA VISION AG, its branches and subsidiaries herewith exclude any liability for third-party information recognizably contained in this email or its attachments. Third-party information does not necessarily reflect the opinion of GP Inspect GmbH or ISRA VISION AG.
> ----------------------------------------------------------------------
> --------------------------------
> ----------------------------------------------------------------------
> -------------------------------- 
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Pieter Hintjens
CEO of iMatix.com
Founder of ZeroMQ community
blog: http://hintjens.com
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org

More information about the zeromq-dev mailing list