[zeromq-dev] Assertion failed: nbytes == sizeof (command_t) (mailbox.cpp:246) during orderly shutdown.
Mike Pearce
mike at kaew.be
Mon May 16 14:40:27 CEST 2011
♫
Hi,
Thanks for your emails regard this.
I attach a test that creates the error. Unfortunately the error is part of a
race condition and I found that it occurs more frequently if
zmq::mailbox_t::recv function can loop faster. I added a debug output to
show when nbytes==0 but this reduced the error frequency and so I added
another debug which skips this additional test for the most common condition
(i.e. nbytes==sizeof(command_t)). This means that the bottom of the function
now looks like :
#endif
if (nbytes == sizeof (command_t)) return 0; // I added this as a quicker
exit for the code
// Sanity check for success.
errno_assert (nbytes != -1);
if (nbytes!= sizeof (command_t)) printf("nbytes=%d\n",nbytes); // Here I
test and output my printf in the case where the error occurs
// Check whether we haven't got half of command.
zmq_assert (nbytes == sizeof (command_t));
return 0;
If you prefer then you do not need to add any additional statements for the
error to occur but I found this debug output rather useful.
Sorry also that the test is using QT. I am guessing that QT is making a big
difference regard this race condition and so I am not sure of any advantage
to remove it,
I am also seeing a much worse problem and when you run the test you may also
see this. zmq_term hangs in mailbox which is awaiting the reaper thread to
clean up but it never comes back and so nothing exits. I have yet to
understand what is happening as I need to also avoid this problem but I do
not have sufficient information yet to be able to report the issue. If you
have any ideas on this fault then it will also be most helpful.
Thanks,
Mike.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110516/39ff7701/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zmqtest.tar
Type: application/x-tar
Size: 3000320 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110516/39ff7701/attachment.tar>
More information about the zeromq-dev
mailing list