David <dsternli...@infinidat.com> added the comment:

Hi asvetlov,

Thank you for your reply.

I'm currently trying to debug a network issue, but I cannot determine the root 
cause of it because of lack of logs. It would be extremely helpful for my 
debugging if we could log the error that was raised by getpeername.

I noticed that in asyncio.proactor_events._set_socket_extra there *is* some 
logging of exceptions. 

```
def _set_socket_extra(transport, sock):
    transport._extra['socket'] = trsock.TransportSocket(sock)

    try:
        transport._extra['sockname'] = sock.getsockname()
    except socket.error:
        if transport._loop.get_debug():
            logger.warning(
                "getsockname() failed on %r", sock, exc_info=True)

    if 'peername' not in transport._extra:
        try:
            transport._extra['peername'] = sock.getpeername()
        except socket.error:
            # UDP sockets may not have a peer name
            transport._extra['peername'] = None
```

Although I see that there there's also a check `if transport._loop.get_debug()` 
so that it won't pollute the log. Would you like me to add that check to my 
patch too?

Thanks!

----------

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

Reply via email to