Skip to content

Instantly share code, notes, and snippets.

@drbobbeaty
Created April 5, 2011 15:31
Show Gist options
  • Select an option

  • Save drbobbeaty/903836 to your computer and use it in GitHub Desktop.

Select an option

Save drbobbeaty/903836 to your computer and use it in GitHub Desktop.
Seg Fault in ZeroMQ 2.1.4 on zmq_msg_size()
bool zmq::encoder_t::message_ready ()
{
// Destroy content of the old message.
zmq_msg_close (&in_progress);
// Read new message. If there is none, return false.
// Note that new state is set only if write is successful. That way
// unsuccessful write will cause retry on the next state machine
// invocation.
if (!source || !source->read (&in_progress)) {
zmq_msg_init (&in_progress);
return false;
}
// Get the message size.
size_t size = zmq_msg_size (&in_progress); // <- line 68
// ...
}
(gdb) bt
#0 zmq_msg_size (msg_=0x16e53c68) at zmq.cpp:208
#1 0x00002b84d9f5de3b in zmq::encoder_t::message_ready (this=0x16e53c20) at encoder.cpp:68
#2 0x00002b84d9f65ffb in zmq::encoder_base_t<zmq::encoder_t>::get_data (this=0x16e53c00) at encoder.hpp:80
#3 zmq::pgm_sender_t::out_event (this=0x16e53c00) at pgm_sender.cpp:165
#4 0x00002b84d9f62c66 in zmq::object_t::process_command (this=0x15996360, cmd_=...) at object.cpp:63
#5 0x00002b84d9f5fafc in zmq::io_thread_t::in_event (this=<value optimized out>) at io_thread.cpp:83
#6 0x00002b84d9f5e3a2 in zmq::epoll_t::loop (this=0x237bb40) at epoll.cpp:161
#7 0x00002b84d9f73c46 in thread_routine (arg_=0x237bbb0) at thread.cpp:71
#8 0x00002b84da9f39ca in start_thread () from /lib/libpthread.so.0
#9 0x00002b84da75070d in clone () from /lib/libc.so.6
size_t zmq_msg_size (zmq_msg_t *msg_)
{
if (msg_->content == (zmq::msg_content_t*) ZMQ_VSM)
return msg_->vsm_size;
if (msg_->content == (zmq::msg_content_t*) ZMQ_DELIMITER)
return 0;
return ((zmq::msg_content_t*) msg_->content)->size; // <- line 208
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment