zeromq/czmq

Assertion failed: Successful WSASTARTUP not yet performed (..\..\..\..\src\signaler.cpp:192)

isaactl opened this issue · 2 comments

This exception thrown when process exit on windows. It actually a exception throw in libzmq, and this issue was report in zeromq/libzmq#1708.
While according to the comments, this issue is that s_process_ctx(zmq::ctx_t) should be called before call DLL termination function.
Although it is not a friendly way to use zmq::ctx_t, but is it possible to solve this issue in czmq?

bluca commented

It's a Windows problem in CZMQ, and it's because Windows lacks a usable way to do the equivalent of atexit() when built as DLL.

You need to manually call zsys_shutdown() before your Windows program exits.

Ran into this issue and wanted to add another workaround to the threads out there:

I fixed it moving zmq::socket_t and context_t to smart pointers in a thread rather than using them as properties of a class.

auto context = std::make_uniquezmq::context_t(1);
auto subscriber = std::make_uniquezmq::socket_t(*context, ZMQ_SUB);
subscriber->connect(VIDEO_PUB_END_POINT);
subscriber->setsockopt(ZMQ_SUBSCRIBE, "", 0);