[issue3826] BaseHTTPRequestHandler depends on GC to close connections
STINNER Victor
report at bugs.python.org
Tue Jan 6 02:09:24 CET 2009
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
I spent two hours on this issue and here are some notes...
(1) SocketIO.close() have to call self._sock._decref_socketios() to
allow the socket to call _real_close()
s = socket...
f = s.makefile()
f.close() # only close the "file view"
s.close() <= close the socket here
(2) SocketIO.close() have to break its reference to allow the socket
to be closed
s = socket...
f = s.makefile()
del s # there is still one reference (f._sock)
f.close() <= the garbage collector will close the socket here
(3) operations on a closed SocketIO should be blocked
s = socket...
f = s.makefile()
f.close()
f.fileno() => error!
So issue3826_gps05.diff have two bugs:
- point (1)
- point (3): can be fixed by adding self._check_closed() (and so we
don't need the local copy of fileno)
Added file: http://bugs.python.org/file12614/socket_real_close-5.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3826>
_______________________________________
More information about the Python-bugs-list
mailing list