[issue10993] HTTPSConnection does not close when call close() method
New submission from Tanakorn Leesatapornwongsa tanakorn@gmail.com: With this code on python 2.6, I found that HTTPSConnection does not close connection properly. from httplib import HTTPSConnection for i in range(1000): https = HTTPSConnection(google.com) https.connect() https.request(GET, /) response = https.getresponse() response.close() https.close() print i After searching python library, I guess that in ssl.py, implementation of close() method of SSLSocket is wrong. socket.close(self) should not be called when self._makefile_refs 1 but should be call when self._makefile_refs == 1, isn't it? I modified the code, made the patch and attached it with this issue. -- components: Library (Lib) files: ssl.py.patch keywords: patch messages: 126919 nosy: tanakorn priority: normal severity: normal status: open title: HTTPSConnection does not close when call close() method type: behavior versions: Python 2.6 Added file: http://bugs.python.org/file20501/ssl.py.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10993 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10993] HTTPSConnection does not close when call close() method
Senthil Kumaran orsent...@gmail.com added the comment: Can you provide a test case which actually illustrates that zombie socket connections present after the HTTPS Connection and Close? I see the logic in your patch. But I don't see no left over unclosed connections upon ssl.close either. -- nosy: +orsenthil Added file: http://bugs.python.org/file20502/unnamed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10993 ___Can you provide a test case which actually illustrates that zombie socket connections present after the HTTPS Connection and Close?divI see the logic in your patch. But I don#39;t see no left over unclosed connections upon ssl.close either.br /div ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10993] HTTPSConnection does not close when call close() method
Changes by Senthil Kumaran orsent...@gmail.com: Removed file: http://bugs.python.org/file20502/unnamed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10993 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10993] HTTPSConnection does not close when call close() method
Tanakorn Leesatapornwongsa tanakorn@gmail.com added the comment: I ran this attached file on my FreeBSD. After it printed loop finished, I ran command `sockstat | grep python` and it showed korn python 58627 3 tcp4 10.0.2.15:28858 64.233.183.99:443 korn python 58627 4 tcp4 10.0.2.15:23579 64.233.183.147:443 korn python 58627 5 tcp4 10.0.2.15:52398 64.233.183.106:443 korn python 58627 6 tcp4 10.0.2.15:18764 64.233.183.105:443 korn python 58627 7 tcp4 10.0.2.15:46159 64.233.183.104:443 korn python 58627 8 tcp4 10.0.2.15:36906 64.233.183.103:443 korn python 58627 9 tcp4 10.0.2.15:45537 64.233.183.99:443 korn python 58627 10 tcp4 10.0.2.15:24578 64.233.183.103:443 korn python 58627 11 tcp4 10.0.2.15:26374 64.233.183.147:443 korn python 58627 12 tcp4 10.0.2.15:57399 64.233.183.106:443 korn python 58627 13 tcp4 10.0.2.15:12670 64.233.183.105:443 korn python 58627 14 tcp4 10.0.2.15:56306 64.233.183.104:443 korn python 58627 15 tcp4 10.0.2.15:42741 64.233.183.103:443 korn python 58627 16 tcp4 10.0.2.15:16112 64.233.183.99:443 korn python 58627 17 tcp4 10.0.2.15:25839 64.233.183.147:443 korn python 58627 18 tcp4 10.0.2.15:59310 64.233.183.106:443 korn python 58627 19 tcp4 10.0.2.15:35349 64.233.183.105:443 korn python 58627 20 tcp4 10.0.2.15:31881 64.233.183.104:443 korn python 58627 21 tcp4 10.0.2.15:21328 64.233.183.103:443 korn python 58627 22 tcp4 10.0.2.15:61880 64.233.183.99:443 korn python 58627 23 tcp4 10.0.2.15:47151 64.233.183.147:443 korn python 58627 24 tcp4 10.0.2.15:12796 64.233.183.106:443 korn python 58627 25 tcp4 10.0.2.15:57142 64.233.183.105:443 korn python 58627 26 tcp4 10.0.2.15:17930 64.233.183.104:443 korn python 58627 27 tcp4 10.0.2.15:13166 64.233.183.103:443 korn python 58627 28 tcp4 10.0.2.15:43557 64.233.183.99:443 korn python 58627 29 tcp4 10.0.2.15:39800 64.233.183.147:443 korn python 58627 30 tcp4 10.0.2.15:17364 64.233.183.106:443 korn python 58627 31 tcp4 10.0.2.15:50822 64.233.183.105:443 korn python 58627 32 tcp4 10.0.2.15:59156 64.233.183.104:443 korn python 58627 33 tcp4 10.0.2.15:41756 64.233.183.103:443 korn python 58627 34 tcp4 10.0.2.15:18008 64.233.183.99:443 korn python 58627 35 tcp4 10.0.2.15:44461 64.233.183.147:443 This should not be happend because I call https.close() in every loop iteration. And after I killed this python process, `sockstat | grep python` did not show anything. Is this test case that you want? -- Added file: http://bugs.python.org/file20503/zombiesocket.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10993 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10993] HTTPSConnection does not close when call close() method
Antoine Pitrou pit...@free.fr added the comment: Can you try with either 2.6.6 or 2.7.1? -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10993 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10993] HTTPSConnection does not close when call close() method
Changes by David Stanek dsta...@dstanek.com: -- nosy: +dstanek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10993 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10993] HTTPSConnection does not close when call close() method
Senthil Kumaran orsent...@gmail.com added the comment: I think, we are facing a platform specific bug here. I had tried similar program earlier and I tried your attached snippet with python 2.6.6 and release27-maint branch and I dont see the zombie sockets on Ubuntu 10.10. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10993 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10993] HTTPSConnection does not close when call close() method
Antoine Pitrou pit...@free.fr added the comment: Rather than labelling it a platform-specific issue, I'd like the OP to test with the latest bugfix releases (2.6.6 and 2.7.1). Some things have definitely been fixed recently. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10993 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10993] HTTPSConnection does not close when call close() method
Tanakorn Leesatapornwongsa tanakorn@gmail.com added the comment: I have tested it on python 2.7.1 already. It quite works. Thank you. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10993 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10993] HTTPSConnection does not close when call close() method
Changes by Tanakorn Leesatapornwongsa tanakorn@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10993 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com