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

John Arbash Meinel john at arbash-meinel.com
Fri Apr 13 15:02:22 BST 2007


Martin Pool wrote:
> 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.

Yeah, they are tracebacks in the server thread, not the main thread. So
it is ugly, but doesn't break the test suite.

> 
> 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.

Thanks, good catch.
John
=:->




More information about the bazaar mailing list