[issue28447] socket.getpeername() failure on broken TCP/IP connection

Georgey report at bugs.python.org
Thu Oct 20 00:21:35 EDT 2016


Georgey added the comment:

The socket close accident is not caused by queue or calling handle_sock_error at all, it happened right after select error

After changing the Exception handling of main Thread:
------------------------
            except Exception as err:
                print("error:"+str(err))
                print(sock.getpeername())
                mailbox.put( (("sock_err",sock), 'Server') )
                continue
 
server_sock.close()
========================

I also get the same type of error:

------------------------
Traceback (most recent call last):
  File "C:\Users\user\Desktop\SelectWinServer.py", line 112, in <module>
    data = sock.recv(BUFSIZ)
ConnectionResetError: [WinError 10054] connection forcibly close

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\user\Desktop\SelectWinServer.py", line 123, in <module>
    print(sock.getpeername())
OSError: [WinError 10038] not a socket
========================

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28447>
_______________________________________


More information about the Python-bugs-list mailing list