[zeromq-dev] XREP socket handler seg faulting
Roger Voss
roger.dewayne at gmail.com
Fri Oct 8 05:35:47 CEST 2010
*My first multi-threaded XREP handler works for a burst of client request
but eventually I can make it fault by pushing lots of request at it (am
using zmq 2.0.9 release):*
Program received signal SIGSEGV, Segmentation fault.
[Switching to thread 16452.0xe04]
0x6979cf55 in zmq_msg_close () from
C:\msys\1.0\home\rvoss\workspace-cpp\zmq-interconnect\trunk\Debug\libzmq.dll
(gdb) info stack
#0 0x6979cf55 in zmq_msg_close () from
C:\msys\1.0\home\rvoss\workspace-cpp\zmq-interconnect\trunk\Debug\libzmq.dll
#1 0x6978d4ff in zmq::pipe_t::~pipe_t ()
from
C:\msys\1.0\home\rvoss\workspace-cpp\zmq-interconnect\trunk\Debug\libzmq.dll
#2 0x6978bfed in zmq::reader_t::process_pipe_term_ack ()
from
C:\msys\1.0\home\rvoss\workspace-cpp\zmq-interconnect\trunk\Debug\libzmq.dll
#3 0x69789502 in zmq::object_t::process_command ()
from
C:\msys\1.0\home\rvoss\workspace-cpp\zmq-interconnect\trunk\Debug\libzmq.dll
#4 0x6978199e in zmq::app_thread_t::process_commands ()
from
C:\msys\1.0\home\rvoss\workspace-cpp\zmq-interconnect\trunk\Debug\libzmq.dll
#5 0x6979730f in zmq::socket_base_t::recv ()
from
C:\msys\1.0\home\rvoss\workspace-cpp\zmq-interconnect\trunk\Debug\libzmq.dll
#6 0x6979d485 in zmq_recv () from
C:\msys\1.0\home\rvoss\workspace-cpp\zmq-interconnect\trunk\Debug\libzmq.dll
#7 0x6da417ba in worker_start_routine (arg=0x3e2e98) at
./src/listener.cpp:123
#8 0x679c445d in ptw32_threadStart (vthreadParms=0xe1e618) at
./src/ptw32_threadStart.c:219
#9 0x77c3a3b0 in msvcrt!_endthreadex () from C:\WINDOWS\system32\msvcrt.dll
#10 0x7c80b729 in KERNEL32!GetModuleFileNameA () from
C:\WINDOWS\system32\kernel32.dll
*It's failing somewhere in this function in zmq.cpp:*
int zmq_msg_close (zmq_msg_t *msg_)
{
// For VSMs and delimiters there are no resources to free.
if (msg_->content == (zmq::msg_content_t*) ZMQ_DELIMITER ||
msg_->content == (zmq::msg_content_t*) ZMQ_VSM)
return 0;
// If the content is not shared, or if it is shared and the reference.
// count has dropped to zero, deallocate it.
zmq::msg_content_t *content = (zmq::msg_content_t*) msg_->content;
if (!(msg_->flags & ZMQ_MSG_SHARED) || !content->refcnt.sub (1)) {
// We used "placement new" operator to initialize the reference.
// counter so we call its destructor now.
content->refcnt.~atomic_counter_t ();
if (content->ffn)
content->ffn (content->data, content->hint);
free (content);
}
return 0;
}
*I'm binding the zmq socket once and then each thread attempts to use that
zmq socket for its respective call to zmq_recv() and eventually zmq_send().*
*
*
*Every time one thread gets a msg from zmq_recv(), another thread is started
so as to call zmq_recv() while the original thread processes its msg and
returns a response to the client.*
*
*
*I'm under the impression that a socket returned by zmq_socket(ctx,ZMQ_XREQ)
is thread safe. Am I mistaken?*
*
*
*--RogerV*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20101007/52f6722b/attachment.htm>
More information about the zeromq-dev
mailing list