[RFC/MERGE] select.select() raises EBADF on closed socket on Mac OS X

Martin Pool mbp at sourcefrog.net
Thu Apr 12 23:03:24 BST 2007


On 4/13/07, John Arbash Meinel <john at arbash-meinel.com> wrote:
> I was testing FTP support on my Mac OSX laptop, and I saw a lot of
> tracebacks involving EBADF.

I get warnings related to this on Linux, but not failures.

It would be nice if there was a clean way to tell Medusa "just stop
listening" but failing that hiding the message is ok with me.
> +    @staticmethod
> +    def _asyncore_loop_ignore_EBADF(*args, **kwargs):
> +        """Wrap asyncore.loop with a try/except for EBADF"""
> +        try:
> +            asyncore.loop(*args, **kwargs)
> +        except select.error, e:
> +            import pdb; pdb.set_trace()
> +            if e.args[0] != errno.EBADF:
> +                raise
> +

Obviously you want to take out the pdb before merging :)

The comment would be better as 'why' not 'what':

   Ignore EBADF, which occurs when we terminate the server by closing
its socket.

+1

-- 
Martin



More information about the bazaar mailing list