[zeromq-dev] Test case for the "Assertion failed: nbytes == sizeof (command_t)" error.

Pieter Hintjens ph at imatix.com
Sun Jun 12 12:30:55 CEST 2011


On Sun, Jun 12, 2011 at 12:08 PM, Luc Heinrich <luc at honk-honk.com> wrote:

> The assertion(s) occur(s) when pressing ctrl-C, which I assume you probably did to exit this sleeping-and-doing-nothing test case and which I assume you did not see, which would mean that OMQ/3.0 does not have the problem ? :)

I've tested this on Linux, 0MQ/2.1.7, and it doesn't provoke any error.

However doing any real work in the signal handler is dangerous. You
simply cannot rely on memory allocations, or the stack, working
sanely. One safe way of handling Ctrl-C is to set a global variable,
which you can then test in your code. This is how CZMQ does it.

Conclusion: your error messages are the system-dependent result of
corrupted 0MQ state cased by trying to do 0MQ calls from within the
signal handler.

-Pieter



More information about the zeromq-dev mailing list