Message260632
When using socketserver to create a simple server for Unix Domain sockets (see server_dgram.py), and when sending data with a client that immediately shuts down (without waiting for a response, on Linux I test with 'echo data | nc -Uu -w 0 /tmp/s.socket') I get this exception:
Exception happened during processing of request from /tmp/nc.XXXXsuGc1C
Traceback (most recent call last):
File "/usr/lib/python3.4/socketserver.py", line 617, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.4/socketserver.py", line 344, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.4/socketserver.py", line 675, in __init__
self.finish()
File "/usr/lib/python3.4/socketserver.py", line 752, in finish
self.socket.sendto(self.wfile.getvalue(), self.client_address)
FileNotFoundError: [Errno 2] No such file or directory
The attached patch fixes this by checking if there is something to send before calling sendto.
Also I am wondering if we should catch FileNotFoundError (and possibly other exceptions) here, because with TCP or UDP, the server does not raise any exception if client is disconnected when finish is called in the handler.
Thank you |
|
Date |
User |
Action |
Args |
2016-02-21 19:28:46 | desbma | set | recipients:
+ desbma, ronaldoussoren, ned.deily |
2016-02-21 19:28:45 | desbma | set | messageid: <1456082925.77.0.767922099224.issue26403@psf.upfronthosting.co.za> |
2016-02-21 19:28:45 | desbma | link | issue26403 messages |
2016-02-21 19:28:44 | desbma | create | |
|