[zeromq-dev] Are bindings supposed to set linger on implicit close/destroy?

André Caron andre.l.caron at gmail.com
Thu Mar 19 13:36:46 CET 2015


FWIW, I've been bitten several times by a close without linger and I now
explicitly set the linger on each socket.  It's quite annoying to have to
set `.close(linger=1)` everywhere.  It also means I can't use the
"contextlib.closing" context manager to automatically close the socket and
I have to write my own instead.

Cheers,

André

On Thu, Mar 19, 2015 at 3:53 AM, Pieter Hintjens <ph at imatix.com> wrote:

> The sentiment comes from trying and failing to fix the libzmq API on
> several occasions. You'll recall the last time I tried. It's not even
> clear that the linger setting *works* in libzmq, as people have
> reported it simply blocks for N seconds without sending anything.
> However, switching it off has worked very well in CZMQ, for years.
>
> On Thu, Mar 19, 2015 at 2:27 AM, MinRK <benjaminrk at gmail.com> wrote:
> > (pyzmq maintainer here)
> >
> > I disagree with the sentiment expressed in the Guide. Either it belongs
> as
> > the libzmq default behavior itself, or it doesn't. It doesn't make sense
> to
> > me for language bindings to unanimously disagree with libzmq instead of
> > changing the underlying libzmq behavior.
> >
> > -MinRK
> >
> > On Wed, Mar 18, 2015 at 9:17 PM, Dylan Cali <calid1984 at gmail.com> wrote:
> >>
> >> Hello,
> >>
> >> The zguide states at the end of "Making a Clean Exit":
> >>
> >>> you need to shut down each socket that has ongoing requests. The proper
> >>> way is to set a low LINGER value (1 second), and then close the
> socket. If
> >>> your language binding doesn't do this for you automatically when you
> destroy
> >>> a context, I'd suggest sending a patch.
> >>>
> >>> ...
> >>>
> >>> Voila! It's complex and painful enough that any language binding author
> >>> worth his or her salt will do this automatically and make the socket
> closing
> >>> dance unnecessary.
> >>
> >>
> >> Yet I noticed the pyzmq bindings do not seem to follow this convention
> and
> >> scripts that do not explicitly set linger themselves hang.  The pyzmq
> devs
> >> closed this as a non-issue:
> >>
> >> https://github.com/zeromq/pyzmq/issues/102
> >>
> >> Conversely, both the czmq and jzmq bindings do set a low linger:
> >>
> >> https://github.com/zeromq/czmq/issues/116
> >> http://git.io/hBaf
> >>
> >> So should this be considered a bug in pyzmq, and as a bindings author
> >> should I follow the convention of setting a low linger?
> >>
> >> Thanks much,
> >> Dylan
> >>
> >>
> >>
> >> _______________________________________________
> >> zeromq-dev mailing list
> >> zeromq-dev at lists.zeromq.org
> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >>
> >
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150319/37d04a51/attachment.htm>


More information about the zeromq-dev mailing list