Guido van Rossum added the comment:

The second error is easy to explain and fix: it's a race condition between the 
OS thread used to call getaddrinfo() and the main thread. The method 
_write_to_self() in selector_events.py is hopelessly naive. It should probably 
become something like this:

    def _write_to_self(self):
        csock = self._csock
        if csock is not None:
            try:
                self._csock.send(b'x')
            except OSError:
                pass

It is possible that the main thread closes csock at any time, and calling 
send() on a closed socket will raise OSError with errno=9 (EBADF). Fortunately 
this is because close() sets the fd to -1; so there is no worry about reuse of 
the fd.

I will investigate the first traceback next.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21447>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to