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 desbma
Recipients desbma, ned.deily, ronaldoussoren
Date 2016-02-21.19:28:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1456082925.77.0.767922099224.issue26403@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2016-02-21 19:28:46desbmasetrecipients: + desbma, ronaldoussoren, ned.deily
2016-02-21 19:28:45desbmasetmessageid: <1456082925.77.0.767922099224.issue26403@psf.upfronthosting.co.za>
2016-02-21 19:28:45desbmalinkissue26403 messages
2016-02-21 19:28:44desbmacreate