[zeromq-dev] Problem with DEALER - ROUTER (assertions in mailbox.cpp:79)

Niels Berglund niels.it.berglund at gmail.com
Sun Apr 7 20:09:53 CEST 2013


Hi all!
So I am playing around with ZeroMq i order to get to grips how to create
applications using it. I am running on Windows using the ClrZmq binding,
and I am getting assert exceptions as per the title of this mail. When
reading about this assert, it seems that it is related to threading issues,
but I can't for the life of me see how I can handle the code in any other
way than what I am doing.

Anyway, the test consists of two applications a client (DEALER socket) and
a service (ROUTER socket). The client sends in a very tight loop a number
of messages - this is configured in a config file. The service (the ROUTER)
receives the messages and sends a reply back. On the client I receive the
message and increments a counter of how many messages I have received.

The problem is that up to a certain number of messages (let's say the
configured value is 50,000) everything works fine, then when I set the
number to be higher (60,000 for example) I get this assert error. The thing
is however that I do not receive it after the 50,000 - but I can receive it
anywhere in the process (i.e. 5,000 , 10,000 etc). That baffles me a bit.
The HighWatermark for both send and receive is set to a very large number,
much higher than the configured value.

My assumption is that this assert has something to do with threading, but I
cannot see how to architect the app and running everything from one thread.
At the moment I have a TestSocket class, where I create the socket, have
the receive and send logic etc. A receive will fire an event exposing the
message received.  A TestClass creates the TestSocket class, subscribes to
the receive event and also initiates the send of messages.

I have read how the created socket always have to be accessed by the thread
that created it, but I can't see how I can do that and have a poller which
polls for messages. So in my TestSocket class I create the poller and then
starts to poll on a separate thread.

Does anyone have any insights in this?!!

Thanks!

Niels
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130407/bf70cbe3/attachment.htm>


More information about the zeromq-dev mailing list