This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dsternlicht
Recipients asvetlov, dsternlicht, yselivanov
Date 2020-02-24.15:51:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582559511.06.0.526653918436.issue39700@roundup.psfhosted.org>
In-reply-to
Content
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!
History
Date User Action Args
2020-02-24 15:51:51dsternlichtsetrecipients: + dsternlicht, asvetlov, yselivanov
2020-02-24 15:51:51dsternlichtsetmessageid: <1582559511.06.0.526653918436.issue39700@roundup.psfhosted.org>
2020-02-24 15:51:51dsternlichtlinkissue39700 messages
2020-02-24 15:51:50dsternlichtcreate