[zeromq-dev] xrep assert when pipe is terminating

Pieter Hintjens ph at imatix.com
Wed Sep 21 15:27:27 CEST 2011


Hi Ben,

Would you create an issue for this? Thanks

-Pieter

On Wed, Sep 21, 2011 at 7:19 AM, Ben Gray <ben at benjamg.com> wrote:
> This is using the current trunk for zeromq 3.0
>
> I have repeatable assert that comes up under load in a service I have
> written that results in the following callstack under gdb.
>
> #0  0x0000003bd2830265 in raise () from /lib64/libc.so.6
> #1  0x0000003bd2831d10 in abort () from /lib64/libc.so.6
> #2  0x00002aaaaab22409 in zmq::xrep_t::xsend (this=0x7cc5e0,
> msg_=0x42802510, flags_=0) at xrep.cpp:168
> #3  0x00002aaaaab0f355 in zmq::rep_t::xsend (this=0x7cc5e0, msg_=0x42802510,
> flags_=0) at rep.cpp:48
> #4  0x00002aaaaab1a492 in zmq::socket_base_t::send (this=0x7cc5e0,
> msg_=0x42802510, flags_=0) at socket_base.cpp:521
> #5  0x00002aaaaab254e7 in zmq_sendmsg (s_=0x7cc5e0, msg_=0x42802510,
> flags_=0) at zmq.cpp:266
> #6  0x00002aaaaab2522e in zmq_send (s_=0x7cc5e0, buf_=0x848328, len_=134,
> flags_=0) at zmq.cpp:219
>
> The relevent code here in xrep.cpp is
>
> if (current_out) {
>     bool ok = current_out->write (msg_);
>     zmq_assert (ok);
>
> The pipe write is returning false because current_out->state is
> 'terminating'.
> Presumably this state was set as the client disconnects.
>
> Because check_write also checks that queues aren't full and the like I
> understand it's a should never happen assert however I'm not sure where it
> assures that it doesn't try and send to the terminating pipe so I'm not sure
> where I should be looking to try and patch this.
> Currently I have a hack that as well as checking current_out also makes sure
> the pipe's state is active.
>
> If someone who knows how this is meant to work it would be most helpful if
> they can explain it.
>
> Although I can cause the failure to happen easily enough with the service
> code, so far I have been unable to produce a minimal test case.
>
> -Ben
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>



More information about the zeromq-dev mailing list