[pypy-issue] [issue867] urllib2 on pypy can leak fd's

Jason Oster tracker at bugs.pypy.org
Thu Oct 17 05:54:38 CEST 2013

Jason Oster <jay at kodewerx.org> added the comment:

I have a similar, but not exact duplicate leak in urllib2 with PyPy 2.1. (Does not 
occur with python 2.7)

Attached a simple test case for it. The leak only occurs with SSL. E.g. changing 
the protocol to "http" in the test case makes the problem go away. And only when 
the response is a non-200. In other words, when urllib2 raises an exception on a 
HTTPS request == leak!

I also added a little workaround for other leaks in the exception handler, which 
at least fixes the case where a non-200 is returned (exception raised) with the 
HTTP protocol.

nosy: +parasyte

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list