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

Björn Kuhlbrodt bjoern.kuhlbrodt at gpsolar.com
Tue Nov 19 15:54:13 CET 2013


Hi Christian

* It is the very first send on that socket that fails. But I'm gaining the impression that to 10% case where the send succeeds are those where I haven't started the application in a while (>~10 minutes, not confirmed). I'm propertly closing the socket and context properly afaik, but may be something is hanging for ~minutes before it kills itself. Procexp shows no processed left from my app though.

* Right, timeout is infinite. If I set a timeout, I get a res = 11 of which neither I nor zmq_strerror can make any sense.

* TCP

BR
Björn

---
I have rougly (see my mail to Pieter for architectual naming):

Central Machine Interface object (owns several machine interface objects, but problem exists also if only one object is instantiated):
	m_pZContext = zmq_ctx_new ();
     
Machine interface objects:
	Sender thread:
		m_pZSendSocket = zmq_socket(m_pZContext, ZMQ_REQ);
		int setOptOn = 1;
		int timeout = 500;
		int res;
		res = zmq_setsockopt(m_pZSendSocket, ZMQ_REQ_CORRELATE, &setOptOn, sizeof(setOptOn));
		res = zmq_setsockopt(m_pZSendSocket, ZMQ_REQ_RELAXED, &setOptOn, sizeof(setOptOn));
		//res = zmq_setsockopt(m_pZSendSocket, ZMQ_SNDTIMEO, &timeout, sizeof(timeout));
		int result = zmq_connect(m_pZSendSocket,"tcp://192.168.189.154:1278");
		if (result != 0)
		...
			else
            ...

            zmq_msg_t request;
  		zmq_msg_init_size(&request, len);

		//copy the payload
		memcpy_s(static_cast<char*>(zmq_msg_data(&request)),len,pStart,len);
		
		int res = zmq_msg_send(&request,m_pZSendSocket,0);
		//This send fails

		zmq_msg_close(&request);
		
	Receiver thread:
 		Pretty much the same, but we're binding instead of connecting and we're using a different port.

-- network boundary --

Machine objects:
	Sender and receiver thread very much like above
------------------------------------------------------------------------------------------------------

-----Original Message-----
From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Christian Kamm
Sent: Dienstag, 19. November 2013 15:11
To: ZeroMQ development list
Subject: Re: [zeromq-dev] Can't get ZMQ_REQ_RELAXED to run

Thanks for the data. I have some more questions, observations:

* So it's really the very first send() call on the REQ socket that fails? I'm asking because REQ_RELAXED has no effect at all on the first send. Please double check!
* From the stacktrace, it looks like you're running into the send timeout (which is probably left at the default, infinite?) because there are no active pipes.
* 'No active pipe' could be caused by REQ_RELAXED terminating the pipe where no message was received in time. But a new one should come up automatically. Which protocol are you using?

Regards,
Christian


On 11/19/2013 02:49 PM, Björn Kuhlbrodt wrote:
> Hi Christian
> 
> Well, it's stuck in zmq::mailbox_t::recv {int rc = signaler.wait 
> (timeout_);}. Note that this is the first message of a newly created 
> socket I'trying to queue. The architecture is a bit more complex, see 
> my reply to Pieters mail. Ah, also note that the send fail only in 
> about 90% of the times I start the application. In the other 10% it 
> runs just fine. Also note that everything is fine once I set 
> ZMQ_REQ_RELAXED to false.
> 
> I also tried to make a minimal version that I could post, but the 
> minimal version works of course...
> 
> Best regards Björn
> 
> 
> 
> libzmq.dll!zmq::signaler_t::wait(int timeout_)  Line 213	C++
>> libzmq.dll!zmq::mailbox_t::recv(zmq::command_t * cmd_, int
>> timeout_)  Line 72 + 0xb bytes	C++
> libzmq.dll!zmq::socket_base_t::process_commands(int timeout_, bool
> throttle_)  Line 901	C++ 
> libzmq.dll!zmq::socket_base_t::send(zmq::msg_t * msg_, int flags_)
> Line 722 + 0xd bytes	C++ libzmq.dll!zmq_msg_send(zmq_msg_t * msg_,
> void * s_, int flags_)  Line 593 + 0x1b bytes	C++
> 
> ----------------------------------------------------------------------
> --------------------------------
>
> 
-----Original Message-----
> From: zeromq-dev-bounces at lists.zeromq.org
> [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Christian 
> Kamm Sent: Dienstag, 19. November 2013 06:11 To: ZeroMQ development 
> list Subject: Re: [zeromq-dev] Can't get ZMQ_REQ_RELAXED to run
> 
> A stack trace of the process when zmq_msg_send() blocks could already 
> be telling. It sounds like it's getting stuck in either
> pipe::terminate() or dealer::xrecv()...
> 
> Cheers, Christian
> 
> Pieter Hintjens <ph at imatix.com> wrote:
> 
>> Hi Björn,
>> 
>> The best thing when it comes to specific functionalities like this is 
>> a minimal test case that shows the problem.
>> 
>> -Pieter
>> 
>> 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.
>>> --------------------------------------------------------------------
>>> -
>>>
>>> 
---------------------------------
>>> WWW.GPSOLAR.COM
>>> 
>>> WWW.ISRAVISION.COM
>>> --------------------------------------------------------------------
>>> -
>>>
>>> 
---------------------------------
>>> _______________________________________________ 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 
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________ zeromq-dev mailing 
> list zeromq-dev at lists.zeromq.org 
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________ zeromq-dev mailing 
> list zeromq-dev at lists.zeromq.org 
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 

_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


More information about the zeromq-dev mailing list