[zeromq-dev] Improper socket/context shutdown and some other questions

Rabedik rabedik at gmail.com
Thu Feb 23 22:49:43 CET 2012

Hi, I've been running into some strange behavior with ZeroMQ, and the fact
that I couldn't find others with the same problem probably means I'm doing
something wrong, so here goes.

First off, the basics. I'm running Windows 7 x64 with libzmq 3.1 beta. I
have a PUB-SUB setup (with some multi-part messages) over TCP. Originally I
didn't care about properly shutting down the context or sockets and
everything seemed to work fine. Then I started noticing that whenever the
subscriber program would crash, the publisher would crash as well with the
following error message:

Assertion failed: !incomplete_in (..\..\..\src\session_base.cpp:209)

... so in the client destructor I added some code to shut down the socket
and context at exit. Hooray, now when the client crashes the server stays
up! However, the client prints the following during the shutdown procedure:

Assertion failed: Successful WSASTARTUP not yet performed

This doesn't make sense to me because data was flowing through the socket,
so the socket would have to be started. Similarly, if I add the
socket/context shutdown on the publisher side, it prints the following when
it crashes:

Assertion failed: Network SubSystem is unavailable

These are probably all manifestations of the same mistakes on my part. Any
insight would be helpful, and please let me know if there's other
information that I should provide.

Also, I have a couple of more minor questions. First, I'm considering using
PAIR sockets over INPROC for doing inter-thread communication. However for
my application latency is really important and I can't afford an
unnecessary delay in signalling. What is the overhead of using zmq sockets
for this as compared to a standard boost::mutex? Secondly, I tried finding
a way to build zeromq statically with my application (so I don't have to
use libzmq.dll) but it looks like this is currently unsupported. Has anyone
had any success in doing a static build with MSVC 2010?

Thanks very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120223/a8a056c6/attachment.htm>

More information about the zeromq-dev mailing list