[zeromq-dev] Problem with pub/sub in same thread in unit test

Justin Azoff justin.azoff at gmail.com
Thu Nov 30 16:04:23 CET 2017


On Thu, Nov 30, 2017 at 9:53 AM, Brian Wagener
<Android at forceconstant.com> wrote:
> I am having some problems with a unit test getting hung. And the only thing
> I can think of is if running the pub and sub in same thread is causing an
> issue.  The issue is on sub side zmq_msg_recv blocks forever even though
> data is written to by pub.  If i use with DONTWAIT then I get EAGAIN instead
> of first message from pub but next recv works and gets the second message.
> If I run sub client as a separate app it works as expected.   Any ideas what
> I am missing?
> Thanks
> Brian
>

What order are you starting them in?  If you send something into a PUB
socket that has no subscribers yet, the data will just be silently
dropped.
This is probably what you are seeing.

This is kind of covered in the guide under this section:

http://zguide.zeromq.org/page:all#Node-Coordination





-- 
- Justin



More information about the zeromq-dev mailing list