[zeromq-dev] Bad file descriptor in rm_fd()

Richard_Newton at waters.com Richard_Newton at waters.com
Wed Nov 6 16:55:12 CET 2013

Well, hopefully I haven't broken anything, it looks OK to me.

For the record, a way I found to make this trigger every time is to put a 1 second sleep between the unlock and the relock, and a 0.5 second sleep at
the start of reaper_t::process_reaped (without the delay in process_repeaped the second stop gets sent but the mailbox gets closed before its


From:	"Pieter Hintjens" <ph at imatix.com>
To:	"ZeroMQ development list" <zeromq-dev at lists.zeromq.org>,
Date:	06/11/2013 03:45 PM
Subject:	Re: [zeromq-dev] Bad file descriptor in rm_fd()
Sent by:	zeromq-dev-bounces at lists.zeromq.org

On Wed, Nov 6, 2013 at 4:31 PM, <Richard_Newton at waters.com> wrote:
> OK, so investigating this, I think https://github.com/zeromq/libzmq/pull/738 may solve the issue.
> What I think is happening is ctx_t::terminate, we set the state to terminating then immediately unlock and relock the slot_sync lock.
> If the last destroy_socket gets in while we are brief unlocked, both destroy_socket and terminate will issue a reaper->stop (), so we will call
process_stop twice.
> Anyone know why we do the unlock/relock dance?

I'd guess this was an attempt by Sustrik to make the shutdown work
properly. It's always been a difficult part of the design.

zeromq-dev mailing list
zeromq-dev at lists.zeromq.org

The information in this email is confidential, and is intended solely for the addressee(s). 
Access to this email by anyone else is unauthorized and therefore prohibited.  If you are 
not the intended recipient you are notified that disclosing, copying, distributing or taking 
any action in reliance on the contents of this information is strictly prohibited and may be unlawful.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131106/228fee39/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131106/228fee39/attachment.gif>

More information about the zeromq-dev mailing list