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.

classification
Title: socketserver problem upon disconnection (undefined member)
Type: Stage:
Components: Library (Lib) Versions: Python 3.0
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: eblond, victorpoluceno
Priority: normal Keywords:

Created on 2009-04-13 04:31 by eblond, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg85936 - (view) Author: Eric Blond (eblond) Date: 2009-04-13 04:30
Here's the traceback I got:
===
>>> s.serve_forever()
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 
54611)
Traceback (most recent call last):
  File "C:\Python30\lib\socketserver.py", line 281, in 
_handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python30\lib\socketserver.py", line 307, in process_request
    self.finish_request(request, client_address)
  File "C:\Python30\lib\socketserver.py", line 320, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python30\lib\socketserver.py", line 615, in __init__
    self.finish()
  File "C:\Python30\lib\socketserver.py", line 655, in finish
    if not self.wfile.closed:
AttributeError: 'RequestHandler' object has no attribute 'wfile'
----------------------------------------
===

's' is an instance of socketserver.TCPServer and the handler passed is 
an instance of socketserver.StreamRequestHandler.

I believe this must be a simple typo, so I didn't feel that more 
details is needed at that point.

Let me know if you have any question.
msg85949 - (view) Author: Victor Godoy Poluceno (victorpoluceno) Date: 2009-04-13 15:11
Can you provide a small example of this error?

This problem seems only occurer when a subclass of
socketserver.StreamRequestHandler provide a blank method "setup".

In your log error:

>> AttributeError: 'RequestHandler' object has no attribute 'wfile'

The class 'RequestHandler' is a subclass of
socketserver.StreamRequestHandler?
msg85951 - (view) Author: Eric Blond (eblond) Date: 2009-04-13 15:33
That's it actually.

I forgot to call base class' setup() method when I redefined it in my 
subclass. When I properly call StreamRequestHandler.setup() on my 
derived class' setup(), everything works fine.

I'm not a socketserver specialist, but I would have expected 
StreamRequestHandler to derive from RequestHandler and not the other 
way round, although it makes little difference to me as a user's point 
of view.

Thanks a lot for pointing my mistake!

Cheers,
-Eric
History
Date User Action Args
2022-04-11 14:56:47adminsetgithub: 49996
2009-04-13 23:09:12benjamin.petersonsetresolution: not a bug
2009-04-13 15:33:29eblondsetstatus: open -> closed
2009-04-13 15:33:15eblondsetmessages: + msg85951
2009-04-13 15:11:26victorpolucenosetnosy: + victorpoluceno
messages: + msg85949
2009-04-13 04:31:01eblondcreate