[issue39700] asyncio.selector_events._SelectorTransport: Add logging when sock.getpeername() fails

David report at bugs.python.org
Thu Feb 20 08:00:09 EST 2020


New submission from David <dsternlicht at infinidat.com>:

`sock.getpeername` can fail for multiple reasons (see https://pubs.opengroup.org/onlinepubs/7908799/xns/getpeername.html) but in  `asyncio.selector_events._SelectorTransport` it's try/excepted without any logging of the error:

```
        if 'peername' not in self._extra:
            try:
                self._extra['peername'] = sock.getpeername()
            except socket.error:
                self._extra['peername'] = None
```

This makes it very difficult to debug. Would it be OK if I added here a log with information on the error?

Thanks!

----------
components: asyncio
messages: 362317
nosy: asvetlov, dsternlicht, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.selector_events._SelectorTransport: Add logging when sock.getpeername() fails
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39700>
_______________________________________


More information about the Python-bugs-list mailing list