[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2009-01-05 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file12614/socket_real_close-5.patch ___ Python tracker ___ ___ Python-bugs-lis

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2009-01-05 Thread STINNER Victor
STINNER Victor added the comment: socket_real_close-5.patch: my own patch developed for the issue #4791 (which is exactly the same problem) to fix SocketIO: - set self._sock=None on close - update the io reference count directly in close() (but also in destructor) - add a regression test Y

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2009-01-05 Thread STINNER Victor
STINNER Victor 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

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2009-01-05 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2009-01-05 Thread STINNER Victor
STINNER Victor added the comment: > Also, I think the SocketIO.fileno mathod should change to: (...) Since SocketIO.fileno() just calls self._sock.fileno(), it would be easier (and better) to fix socket.socket(). But since socket.fileno() calls socket._fileno() we can just fix it correctly on

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2009-01-05 Thread Gregory P. Smith
Gregory P. Smith added the comment: from #python-dev discussion. agreed, magic attributes are annoying. also, my gps05 patch continues to return the old fileno even after the underlying socket has been closed. that is a problem. I like your patch in #4791 but lets keep both sets of our unit

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2009-01-05 Thread STINNER Victor
STINNER Victor added the comment: Comment about issue3826_gps05.diff: - I don't like "magical" attributes (sometimes it does exist, sometimes not) even if it's a protected attribute (_sock) => use self._sock=None? - fileno() returns a fixed value whereas the socket.fileno() returns -1 when

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2009-01-05 Thread STINNER Victor
STINNER Victor added the comment: Issue #4791 is exaclty the same problem (io reference in SocketIO): I proposed another patch (decrement the io reference but keep the self._sock object unchanged). -- nosy: +haypo ___ Python tracker

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-29 Thread Gabriel Genellina
Gabriel Genellina <[EMAIL PROTECTED]> added the comment: --- El vie 28-nov-08, Gregory P. Smith <[EMAIL PROTECTED]> escribió: > P.S. Gabriel Genellina (gagenellina) - Your comment > sounded like you > had a unit test for this but it never got attached. Still > have it? I've found it; it use

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-29 Thread Gregory P. Smith
Changes by Gregory P. Smith <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file12163/issue3826_socket-gps04.diff ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-29 Thread Gregory P. Smith
Changes by Gregory P. Smith <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file12156/test_makefileclose.patch ___ Python tracker <[EMAIL PROTECTED]> ___

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-29 Thread Gregory P. Smith
Changes by Gregory P. Smith <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file12154/issue3826_socket-gps03.diff ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-29 Thread Gregory P. Smith
Gregory P. Smith <[EMAIL PROTECTED]> added the comment: gps05.diff includes the fix and unittests. Added file: http://bugs.python.org/file12165/issue3826_gps05.diff ___ Python tracker <[EMAIL PROTECTED]>

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-29 Thread Gregory P. Smith
Gregory P. Smith <[EMAIL PROTECTED]> added the comment: Martin: socket.socket has no destructor so a call to socket.socket._real_close() is not guaranteed. Thats fine as its parent class from socketmodule.c _socket.socket does the right thing in its destructor. Amaury: The case you show doesn't

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-29 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: But real_close() is not called either in the trivial socket use: import socket s=socket.socket() s.connect(('www.python.org',80)) del s OTOH, I added some printf statements in socketmodule.c, near all usages of SOCKETCLOSE(). They sho

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-29 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: I don't think this is quite right yet. If I run import socket s=socket.socket() s.connect(('www.python.org',80)) x=s.makefile() del x del s and put a print statement into real_close, I don't see that real_close is invoked. -- nosy:

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-29 Thread Martin v. Löwis
Changes by Martin v. Löwis <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file12153/issue3826_socket-gps02.diff ___ Python tracker <[EMAIL PROTECTED]> ___ __

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-29 Thread Martin v. Löwis
Changes by Martin v. Löwis <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file12151/issue3826_socketserver-gps01.diff ___ Python tracker <[EMAIL PROTECTED]> ___

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-28 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: Patch issue3826_socket-gps03.diff is OK for me. Here is a unit test for this new behavior. Someone should review both patches. -- keywords: +needs review Added file: http://bugs.python.org/file12156/test_makefileclose.patch __

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-28 Thread Gregory P. Smith
Changes by Gregory P. Smith <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file12152/issue3826_socket-gps01.diff ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-28 Thread Gregory P. Smith
Gregory P. Smith <[EMAIL PROTECTED]> added the comment: Indeed IOBase does call close() from its __del__. Excellent. That makes this simpler. -gps03 attached. Added file: http://bugs.python.org/file12154/issue3826_socket-gps03.diff ___ Python tracker <[EMA

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-28 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: I agree that the patch on socket.py is the correct fix: the raw socket should be detached when the close() method is called. I have one remark on the patch: io.IOBase.__del__ already calls close(): could SocketIO.__del__ be removed co

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-28 Thread Gregory P. Smith
Changes by Gregory P. Smith <[EMAIL PROTECTED]>: Added file: http://bugs.python.org/file12153/issue3826_socket-gps02.diff ___ Python tracker <[EMAIL PROTECTED]> ___ ___

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-28 Thread Gregory P. Smith
Gregory P. Smith <[EMAIL PROTECTED]> added the comment: P.S. Gabriel Genellina (gagenellina) - Your comment sounded like you had a unit test for this but it never got attached. Still have it? -- stage: -> patch review ___ Python tracker <[EMAIL P

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-28 Thread Gregory P. Smith
Gregory P. Smith <[EMAIL PROTECTED]> added the comment: Alright I've taken another fresh look at this. I understand the dup semantics issue and don't want to break that. Attached are two patches, either one of these will fix the problem and breakage.py test code attached to this bug. Personall

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-28 Thread Gregory P. Smith
Changes by Gregory P. Smith <[EMAIL PROTECTED]>: Added file: http://bugs.python.org/file12152/issue3826_socket-gps01.diff ___ Python tracker <[EMAIL PROTECTED]> ___ ___

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-11-28 Thread Gregory P. Smith
Changes by Gregory P. Smith <[EMAIL PROTECTED]>: -- keywords: +patch Added file: http://bugs.python.org/file12151/issue3826_socketserver-gps01.diff ___ Python tracker <[EMAIL PROTECTED]> _

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-09-26 Thread Guido van Rossum
Guido van Rossum <[EMAIL PROTECTED]> added the comment: On Thu, Sep 25, 2008 at 10:57 PM, Gregory P. Smith <[EMAIL PROTECTED]> wrote: > The whole socket._io_refs thing looks like a real design flaw. What is > its actual intended purpose? The original purpose was to support the original semantic

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-09-25 Thread Gregory P. Smith
Gregory P. Smith <[EMAIL PROTECTED]> added the comment: The whole socket._io_refs thing looks like a real design flaw. What is its actual intended purpose? When close is called on the socket object itself, the socket MSUT be closed. Why is our API otherwise? Its up to the programming to ensur

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-09-25 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc <[EMAIL PROTECTED]> added the comment: The garbage collector does collect unreachable objects. What happens is that with python 2, the socket is explicitly closed by the HTTPServer, whereas with python 3, the explicit close() does not work, and the socket is ultimately close

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-09-25 Thread romkyns
romkyns <[EMAIL PROTECTED]> added the comment: So the GC behaviour in this case is such that Python 3.0 can't collect the object whereas Python 2.6 can. Is this known / expected or should this be recorded in a separate issue? ___ Python tracker <[EMAIL PROTECT

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-09-24 Thread Rafael Zanella
Changes by Rafael Zanella <[EMAIL PROTECTED]>: -- nosy: +zanella ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list mailing

[issue3826] BaseHTTPRequestHandler depends on GC to close connections

2008-09-21 Thread Gregory P. Smith
Changes by Gregory P. Smith <[EMAIL PROTECTED]>: -- assignee: -> gregory.p.smith nosy: +gregory.p.smith priority: -> critical title: Self-reference in BaseHTTPRequestHandler descendants causes stuck connections -> BaseHTTPRequestHandler depends on GC to close connections