New submission from Valery Khamenya <khame...@gmail.com>: Explanation from dablitz's comment at https://bugs.pypy.org/issue867 :
<quote> urllib2 in the stdlib leaks fd's if an exception is raised while opening a connection. The issue occurs due to a socket being opened then an exception being raised before an object with the socket is returned, leaving no way to explicitly close the object. On cpython this would not be an issue as the object would lose all references almost immediately however it lingers around with a proper GC causing FD's to build up if the same condition happens repeatedly (eg a loop/web crawling) The file enclosed is a script to generate the leakage, to run invok it as follows <python> leak.py pypy should start leaking FD's and can be see in /proc/<pid of leak.py>/fd </quote> Related issues: http://bugs.python.org/issue3066 http://bugs.python.org/issue1208304 http://bugs.python.org/issue1601399 ---------- components: IO, Library (Lib) files: leak.py messages: 145166 nosy: Valery.Khamenya priority: normal severity: normal status: open title: FD leak in urllib2 type: resource usage versions: Python 2.7 Added file: http://bugs.python.org/file23344/leak.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13131> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com