I have one ZMQ_PUB socket in one process, connected to a ZMQ_SUB socket in another process, as it's another server. The only thing I need to do is to publish as many messages I can. I'm sure it's connected first.
I'm running a load test, firing thousands of identical messages from the PUB. At the other side, I'm polling the ZMQ_SUB socket, and receiving the messages only when needed.
The weird thing is that every 1000 messages received, zmq_poll returns ETERM for about 3 times. I can't figure it out.
-- Solution in the comments bellow.
Turns out I was misinterpreting the return code of the poll, recv and send functions. It returns -1 everytime it gets a signal, and it does get a lot of EINTR, that's fine, perfectly normal. I can just ignore them and repeat what I was trying to do. In my polling, I can just continue. If it came from a send or recv, I can keep trying to send or recv as long errno == EINTR. The problem is solved