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

Activity

Show:
Martin Sustrik
October 16, 2010, 9:21 AM

This problem have been reported already. It should be fixed in 2.1 (master). Can you check and confirm? Thanks!

Martin Sustrik
March 1, 2011, 3:25 PM

No answer for several months. Assuming the issue is fixed. Closing it.

miasscerber
March 2, 2011, 4:28 AM

Sorry for not answering, forgot about this issue. I checked 2.1, it is fixed. Thank you.

Assignee

Unassigned

Reporter

miasscerber

Labels

None

Priority

Configure