[zeromq-dev] inproc: If first connect occurs before bind, then retries don't seem to succeed...

Pieter Hintjens ph at imatix.com
Sat Dec 22 13:06:32 CET 2012

Yes, this seems to be a bug. I've logged an issue
https://zeromq.jira.com/browse/LIBZMQ-487 and uploaded a test case:

However I'd advise against retrying a connect. Since you're using this
between threads, you can arrange the thread creation order to always
do the bind (in the parent) before the connect (in the child). In the
rare case where you want to inproc between two child threads, get the
first one to signal to its parent that it's ready before starting the
second one.


On Fri, Dec 21, 2012 at 12:28 PM, Andy Ballingall TF
<ballingall at thefoundry.co.uk> wrote:
> Hi Pieter,
>> For inproc connect works synchronously and requires that bind has
>> happened already. See http://api.zeromq.org/3-2:zmq-inproc#toc4
>> It's not consistent with tcp:// and ipc:// but it does work in most cases.
> The odd thing I'm seeing though is that If my first connect() happens
> to beat the first bind(), - failing as expected - it appears that all
> the future attempts to connect() fail too, even though most of them
> certainly are happening after the bind() has had plenty of time to
> complete.
> If I ensure bind() happens first by using a small sleep() after
> spawning the thread which does the bind(), then it all works fine as
> you say (and I'm running with this workaround for now).
> So it's just this question of whether I should be able to retry an
> initially failing connect() until it succeeds (assuming the bind()
> completes). My test program recreates the scenario with a retry-loop,
> but I can't seem to get the connect() to work at all if it failed
> once, but I'm quite new to zmq and might be making some basic error.
> Thanks,
> Andy
>> -Pieter
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> --
> Andy Ballingall
> Senior Software Engineer
> The Foundry
> 6th Floor, The Communications Building,
> 48, Leicester Square,
> London, WC2H 7LT, UK
> Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906
> Web: http://www.thefoundry.co.uk/
> The Foundry Visionmongers Ltd.
> Registered in England and Wales No: 4642027
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list