[zeromq-dev] ZMQ 3.0.1 crash

Emmanuel TAUREL taurel at esrf.fr
Thu Sep 1 11:18:55 CEST 2011


Hello all,

I am using ZMQ 3.0.1 on a Ubuntu 10.10 box (32 bits)

I am actually experimenting crashes in ZMQ when using ZMQ 3.0.1. If I 
use ZMQ 2.1.7, my software works without any problems.
I am mainly using PUB/SUB pattern.

The publisher publishes a multipart message with 3 parts (one of the 
part is a very small message: only one byte).

The subscriber dynamically connects its subscriber socket to publisher(s).
To do so, the thread in which runs the subscriber socket also has a REP 
socket and is listening on socket events using zmq::poll().
The REP socket is used to receive dynamic connection request for the 
subscriber socket. These requests are sent by other threads using a REQ 
socket
(inproc transport). The connection endpoint and the subscription string 
are sent in the message used by the REQ/REP communication.

The subscriber process crashes when the code tries to connect the 
subscriber socket to a publisher.
The crash happens in one of the 2 ZMQ threads at msg.cpp:126 in method 
zmq::msg_t::close() due to a
"glibc detected free(): invalid pointer"

I am using a ZMQ library compiled with ZMQ_MAKE_VALGRIND_HAPPY.
If I run my subscriber process under valgrind, it works (!) but valgrind 
complains about memory access and invalid free.

I attach to this mail my subscriber and publisher code which contains 
only ZMQ related code (sub.cpp and pub.cpp)
I also attach the output from valgrind (valgrind.out)

To reproduce the crash:

1 - Start one publisher with a port number and a string (pub 5555 Hello)
2 - Start another publisher with another port and string (pub 5556 world)
3 - Wait for publishers to start publishing data
4 - Start the subscriber with the publisher endpoints and strings (sub 
tcp://host:5555 tcp://host:5556 Hello world)

I hope I am clear enough

Thank's for your help

Emmanuel Taurel



-------------- next part --------------
A non-text attachment was scrubbed...
Name: pub.cpp
Type: text/x-c++src
Size: 1613 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110901/bd0b4f55/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sub.cpp
Type: text/x-c++src
Size: 3082 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110901/bd0b4f55/attachment-0001.cpp>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: valgrind.out
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110901/bd0b4f55/attachment.ksh>


More information about the zeromq-dev mailing list