[zeromq-dev] Assertion in mailbox.cpp:78 on Windows when increasing the number of clients

Baptiste Lepilleur baptiste.lepilleur at gmail.com
Sat Mar 5 00:09:15 CET 2011

I just started playing around with pyzmq examples, and I systematically run
into the following assertion on the server whenever I increase the number of

python server.py
Server 7712
Assertion failed: nbytes == sizeof (command_t) (..\..\..\src\mailbox.cpp:78)

This application has requested the Runtime to terminate it in an unusual
Please contact the application's support team for more information.

This correspond to the following piece of code:

    //  TODO: Implement SNDBUF auto-resizing as for POSIX platforms.
    //  In the mean time, the following code with assert if the send()
    //  call would block.
    int nbytes = ::send (w, (char *)&cmd_, sizeof (command_t), 0);
    wsa_assert (nbytes != SOCKET_ERROR);
    zmq_assert (nbytes == sizeof (command_t));

It is not entirely clear to me if it is possible to avoid this situation, or
if it is just that the Windows support is incomplete...

The example I'm using is the device example that I slightly modified by
removing the sleep on the server side, and printing the elapsed time only
every 10 000 messages on the client side and ported to python 3.
(modified server.py:
client.py: http://pastebin.com/C5J6eU1i <http://pastebin.com/C5J6eU1i>)

Windows XP SP3, VS 2008 SP1, zeromq 2.1.1, pyzmq 2.1.1, Python 3.2, Intel
Q9300 (4 cores)

Here the test I did that show when the server crash occurs (don't take the
number seriously, this was not a proper bench environment, I just wanted
some rough figures):

With anti-virus on (Avast 5.1.889):
1 clients: 6.7s = ~1500 messages/s
2 clients: 8.5s = ~2350 messages/s
3 clients: 11.6 = ~2590 messages/s
4 clients: server crash assertion on (..\..\..\src\mailbox.cpp:78)

With anti-virus disabled (but installed Avast 5.1.889):
1 clients: 4.5s = ~2220 messages/s
2 clients: 5.1s = ~3920 messages/s
3 clients: 6.0s = ~5000 messages/s
4 clients: 7.7 = ~5200 messages/s
5 clients: 9.1 = ~5500 messages/s
6 clients: server crash assertion on (..\..\..\src\mailbox.cpp:78)

Is the socket that would block on send an internal ZMQ socket? Can something
be done to avoid the issue?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110305/5216bb1d/attachment.htm>

More information about the zeromq-dev mailing list