More than a single io thread make recv block sometimes

Description

Here is a test program. It works fine almost always. But sometimes - it just blocks on one of recv-s, and causes 100% CPU load. I test it this way:

for i in \`seq 1000\` ; do ./test; done

On my machine it blocks on <100 iteration, on my friend's it's all the same. Changing io threads number to 1 removes the problem. Changing transport to inproc - too. I use zmq 2.0.9

And under valgrind you wouldn't even have to start it hundred times - it blocks on the first run.

#include "zhelpers.h"

int main () {
void *context = zmq_init (2);

s_version ();

char endpoint = "tcp://:5050";

void *server = zmq_socket (context, ZMQ_REP);
zmq_bind (server, endpoint);

void *worker = zmq_socket (context, ZMQ_REQ);
zmq_connect (worker, endpoint);

sleep (1);

for (int i = 0; i < 1000; i++)
{
s_send (worker, "req");
s_dump (server);

s_send (server, "rep");
s_dump (worker);
}

zmq_term (context);
return 0;
}

Environment

None

Status

Assignee

Unassigned

Reporter

miasscerber

Labels

None

Priority