I am working on a tcp network of self discoverable nodes using zyre/czmq. During the development, I run some functional tests by instantiating many nodes from a single process, on different threads, so that I have the basics of the network logic tested for every modification I do.
That worked fine until I recently tried to add a authentication using the zauth actor, which worked just fine when nodes are instantiated in different Linux processes, but fails when nodes are instantiated from a single (test) process. I narrowed down the issue to the following assert in czmq/src/zauth.c:83:
The interesting part is that, if I remove the assert, my network behaves as expected, and my tests PASS just fine, even though rc=-1 on all the subsequent calls to zsock_bind.
It also solves the problem if I set the endpoint to tcp, with each node using a different (free) port, like below:
#define ZAP_ENDPOINT "tcp://127.0.0.1:*[60000-]"
Very honestly, I started recently with zmq, and I dont have the knowledge to judge if this is the expected behavior, or why it does not work from a single thread with inproc, and if this is a bug/limitation, how to fix it.
I am working on a tcp network of self discoverable nodes using zyre/czmq. During the development, I run some functional tests by instantiating many nodes from a single process, on different threads, so that I have the basics of the network logic tested for every modification I do.
That worked fine until I recently tried to add a authentication using the
zauth
actor, which worked just fine when nodes are instantiated in different Linux processes, but fails when nodes are instantiated from a single (test) process. I narrowed down the issue to the following assert inczmq/src/zauth.c:83
:Where the error is:
Where:
The interesting part is that, if I remove the assert, my network behaves as expected, and my tests PASS just fine, even though
rc=-1
on all the subsequent calls tozsock_bind
.It also solves the problem if I set the endpoint to tcp, with each node using a different (free) port, like below:
Very honestly, I started recently with zmq, and I dont have the knowledge to judge if this is the expected behavior, or why it does not work from a single thread with
inproc
, and if this is a bug/limitation, how to fix it.Any ideas on how to address this are appreciated.