[zeromq-dev] Crash in zmq_poll

renju renjumc at gmail.com
Fri Nov 27 03:08:05 CET 2015


Hey all,



I’m using ZeroMQ4.0.4 in windows. Our application uses ZeroMQ as
communication framework.

I came across a strange issue last day with *zeromq_proxy*. Application
crashed while it was shutting down.

Following is the call stack of the dump file.



>             libzmq-v120-mt-gd-4_0_4.dll!zmq::zmq_abort(const char *
errmsg_) Line 71      C++

               libzmq-v120-mt-gd-4_0_4.dll!zmq::signaler_t::wait(int
timeout_) Line 209           C++


libzmq-v120-mt-gd-4_0_4.dll!zmq::mailbox_t::recv(zmq::command_t * cmd_, int
timeout_) Line 72       C++


libzmq-v120-mt-gd-4_0_4.dll!zmq::socket_base_t::process_commands(int
timeout_, bool throttle_) Line 899   C++


libzmq-v120-mt-gd-4_0_4.dll!zmq::socket_base_t::getsockopt(int option_,
void * optval_, unsigned int * optvallen_) Line 294       C++

               libzmq-v120-mt-gd-4_0_4.dll!zmq_getsockopt(void * s_, int
option_, void * optval_, unsigned int * optvallen_) Line 287
C++

               libzmq-v120-mt-gd-4_0_4.dll!zmq_poll(zmq_pollitem_t *
items_, int nitems_, long timeout_) Line 944 C++

               libzmq-v120-mt-gd-4_0_4.dll!zmq::proxy(zmq::socket_base_t *
frontend_, zmq::socket_base_t * backend_, zmq::socket_base_t * capture_)
Line 78               C++

               libzmq-v120-mt-gd-4_0_4.dll!zmq_proxy(void * frontend_, void
* backend_, void * control_) Line 1030               C++



                It is exiting from below line in
zeromq-4.0.4\src\signaler.cpp



                zmq::signaler_t::wait(int timeout_)

                {

                                ……

                                ……

                                int rc = select (0, &fds, NULL,
NULL,timeout_ >= 0 ? &timeout : NULL);

                                wsa_assert (rc != SOCKET_ERROR);

                }



The reproducibility is very less..



On Application shutdown following 3 thing are happening in parallel

                Polling in proxy.

                Proxy will receive a message.

                Closing the sockets.



Following is the proxy wrapper class we used. Can you see anything wrong in
our implementation? Have anyone came across this?



PcvZmqProxy::PcvZmqProxy(

    int frontEndSktType, IPcvZmqConnection& frontEndConn,

    int backEndSktType, IPcvZmqConnection& backEndConn) :

    m_frontEndSkt(m_ctx, frontEndSktType, frontEndConn),

    m_backEndSkt(m_ctx, backEndSktType, backEndConn)

{

    m_proxyThread = std::thread(&PcvZmqProxy::proxyWorkerThreadFunc, this);

}



void PcvZmqProxy::proxyWorkerThreadFunc()

{

    LogI(_T("Starting proxy"));

    zmq_proxy(m_frontEndSkt.getZmqSocket(),

        m_backEndSkt.getZmqSocket(),

        NULL);



    LogI(_T("Proxy exited gracefully"));

}



PcvZmqProxy::~PcvZmqProxy()

{



    //disconnect/Unbind the sockets

    m_backEndSkt.close();

    m_frontEndSkt.close();



    if (m_proxyThread.joinable())

    {

        m_proxyThread.join();

    }

}




With best regards,
Renju Mathew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20151127/6fb48d14/attachment.htm>


More information about the zeromq-dev mailing list