[zeromq-dev] Zeromq and threads

Javier Blesa Martínez jblesa at die.upm.es
Fri Nov 9 13:59:17 CET 2012


Hi,

I ve a c++ code that interconect different classes with zeromq. I work in
Ubuntu 12.04 and the Zeromq version is 3.2.1

A module sends google protobuf in the 0mq socket and other module receives
it and save in a database. When the code runs for 10 seconds or less I can
show this error:

Assertion failed: ok (mailbox.cpp:84)

the dmesg said:

[13436.436619] TWISTTestbedCAg[9592]: segfault at 0 ip   (null) sp b2efefac
error 14 in TWISTTestbedCAgent[8048000+17000]

and the gdb core:

El programa terminó con la señal 11, Segmentation fault.
#0  0xb768f182 in
google::protobuf::MessageLite::ParseFromString(std::string const&) () from
/usr/lib/libprotobuf.so.7
(gdb) bt
#0  0xb768f182 in
google::protobuf::MessageLite::ParseFromString(std::string const&) () from
/usr/lib/libprotobuf.so.7
#1  0x0804fe3a in VirtualControlChannel::RecvProtoBuf (this=0x94a9008,
protobuf=...) at src/VirtualControlChannel.cpp:186
#2  0x0804e233 in endl > (__os=...) at /usr/include/c++/4.6/ostream:544
#3  operator<< (__pf=, this=) at /usr/include/c++/4.6/ostream:115
#4  Discovery::VCCListen (this=0x0, R=0x0, O=0x0, E=0xbffa5b24) at
src/Discovery.cpp:84
#5  0x7ada1c00 in ?? ()

The piece of code with that fuction is:


//Receive ZMQ message and convert into protobuf object
bool VirtualControlChannel::RecvProtoBuf(::google::protobuf::Message
&protobuf)
{
int flag;
assert (this->sock != NULL);
zmq::message_t message;
 flag = this->sock->recv(&message);
if (flag == -1)
{
 throw std::runtime_error("Failed to receive zeromq message: ");
}
 std::string buffer(static_cast<char*>(message.data()), message.size());

printf("Message size: %d\n", message.size());
 std::cout << std::flush;

if (!protobuf.ParseFromString(buffer))
 throw std::runtime_error("Failed to parse protobuf message");
return true;
};

Do you know form where the problem comes?

Best regards,


-- 
----------------------------------
Javier Blesa Martínez
Ingeniero de Telecomunicación
ETSI Telecomunicación - UPM
Laboratorio de Sistemas Integrados - DIE

*Teléfono: +34 91 549 57 00 ext 4223*

*Correo:    jblesa at die.upm.es*

*Web:       www.elb105.es*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20121109/fd1218b9/attachment.htm>


More information about the zeromq-dev mailing list