[zeromq-dev] the reason for zmq_assert (fetched);

hamster YIDIEPXGXGPN at spammotel.com
Mon Aug 2 13:55:18 CEST 2010


Martin Lucina <mato <at> kotelna.sk> writes:

> > Would someone comment on zmq_assert (fetched); appeared on line 197 of 
xrep.cpp
> > (release 2.0.7). It happens sometimes on XREP side of the connection after
> > reception of "header" part of message. Could it be a result of closing of
> > a socket on a XREQ side shortly after sending a message?
> 
> Fixed on master.
> 
> See http://github.com/zeromq/zeromq2/issues/closed#issue/38
> 

It does not seem to help :( After updating from git it started to crash on
receive almost immidiately:

>	libzmqd.dll!zmq_msg_close(zmq_msg_t * msg_=0x000000000f82f6f8)  Line 172 +
0x16 bytes	C++
 	libzmqd.dll!zmq_msg_move(zmq_msg_t * dest_=0x000000000f82f6f8, zmq_msg_t *
src_=0x0000000006793de8)  Line 182	C++
 	libzmqd.dll!zmq::xrep_t::xrecv(zmq_msg_t * msg_=0x000000000f82f6f8, int
flags_=1)  Line 195	C++
 	libzmqd.dll!zmq::socket_base_t::recv(zmq_msg_t * msg_=0x000000000f82f6f8, 
int flags_=1)  Line 387 + 0x1d bytes	C++
 	libzmqd.dll!zmq_recv(void * s_=0x0000000006793c10, zmq_msg_t *
msg_=0x000000000f82f6f8, int flags_=1)  Line 330	C++


It looks like msg_' contents is not initialized (or already destroyed) at that
time:


-		msg_	0x000000000f82f6f8 {content=0x00000000067aca80 flags=0 
vsm_size=0 ...} zmq_msg_t *
		content	0x00000000067aca80	void *
		flags	0	unsigned char
		vsm_size	0	unsigned char
+		vsm_data	0x000000000f82f702
"ННННННННННННННННННННННННННННННММММММММММММММММММММММММ"	unsigned char [30]

-		content	0x00000000067aca80 {data=0xfeeefeeefeeefeee 
size=18369900232523579118 ffn=0xfeeefeeefeeefeee ...}	zmq::msg_content_t *
		data	0xfeeefeeefeeefeee	void *
		size	18369900232523579118	unsigned __int64
		ffn	0xfeeefeeefeeefeee	void (void *, void *)*
		hint	0xfeeefeeefeeefeee	void *
+		refcnt	{value=4277075694 }	zmq::atomic_counter_t



Btw, do I understand correctly, that zmq_msg_t is ref-counted and I can reuse
it's instance after single initialization? Generic template looks like that:

zmq_msg_init(&msg);
while() {
  zmq_poll({sock1, sock2}) // for receive
  if (sock1) {
     zmq_recv(sock1, &msg); // <--- crashed inside
     do_smth(msg)
  }
  if (sock2) {
     zmq_recv(sock2, &msg);
     zmq_send(sock1, &msg);
  }
}

Is it valid or I have to use separate msgs for sock1 and sock2?








More information about the zeromq-dev mailing list