libzmq
libzmq copied to clipboard
Assertion failed after poll
I get the following assertion when receiving on a pull socket:
Assertion failed: pfd.revents & POLLIN (C:\Users\...\vcpkg\buildtrees\zeromq\src\v4.3.5-37c87b6b8c.clean\src\signaler.cpp:238)
Here is the code that raises the assertion:
void Foo::run(std::stop_token stopToken)
{
_injester = zmq::socket_t(_context, zmq::socket_type::pull);
_publisher = zmq::socket_t(_context, zmq::socket_type::pub);
_publisher.bind("inproc://foo");
_injester.bind("inproc://bar");
_injester.set(zmq::sockopt::rcvtimeo, 1000);
while (!stopToken.stop_requested()) {
zmq::message_t message;
auto recvResult = _injester.recv(message); // Assert failed here
if (!recvResult.has_value()) // Timeout
continue;
// do stuff
}
}
I see the assertion is raised in that file: https://github.com/zeromq/libzmq/blob/3e5ce5c1cd75bd93b2ab51d98e0239eb8628b953/src/signaler.cpp#L238
I'm not too familiar with poll so I'm not sure how it's possible to get something else in that place.
~I am on Windows~ This happens on Windows and Linux, running the v4.3.5 version of libzmq.