[zeromq-dev] segfault in zmq_connect

Chuck Remes cremes.devlist at mac.com
Thu Dec 9 14:05:26 CET 2010


On Dec 9, 2010, at 1:08 AM, Mahadevan R wrote:

> 
> On Thu, Dec 9, 2010 at 10:52 AM, Mahadevan R <mdevan.r at gmail.com> wrote:
> 
> On Wed, Dec 8, 2010 at 3:44 PM, Mahadevan R <mdevan.r at gmail.com> wrote:
> Hi guys,
> 
> I'm getting a strange segfault with the following stack:
> 
> #0  0x00007f623e64edd0 in _int_malloc () from /lib/libc.so.6
> #1  0x00007f623e650ad8 in malloc () from /lib/libc.so.6
> #2  0x00007f623c375d4f in zmq::create_pipe (reader_parent_=0x13bdde0, writer_parent_=0x13c0e10, hwm_=1000,
>     swap_size_=0, reader_=0x7fff08b49ad8, writer_=0x7fff08b49ad0) at yqueue.hpp:52
> #3  0x00007f623c37c347 in zmq::socket_base_t::connect (this=0x13bdde0,
>     addr_=0x7f623c594621 "tcp://127.0.0.1:9988") at socket_base.cpp:406
> 
> This is on a 64-bit debian lenny, fairly easily reproducible. Zeromq version is 2.1.0 beta. The crash occurs in a forked child, although parent's context is not touched (not sure if this is relevant). There are many children, all connecting to the same ZMQ_REQ. Context is inited with thread pool size of 1. There is a single ZMQ_REP process (thread pool size 1).
> 
> Also noticed that this does not appear if jemalloc[1] is used, via LD_PRELOAD.
> 
> [1] http://www.canonware.com/jemalloc/
> 
> Hmm.. after removing the use/need for a 0-length message from the protocol, things seems to be OK now. Even with the regular malloc. And on the client (REP) side, I used to get an occasional assert (rep.cpp:87), that too seems to have gone away now.
> 
> How well tested/stable are 0-length messages?
> 
> Cheers,
> -MD.
>  
> 

They *should* be pretty well tested since they are in heavy use by the REQ/REP socket pattern. A 0-length message is used as a delimiter between the routing msg parts and the body of the message.

cr

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20101209/54e58b8d/attachment.htm>


More information about the zeromq-dev mailing list