[New-bugs-announce] [issue11767] Maildir iterator leaks file descriptors by default
report at bugs.python.org
Tue Apr 5 01:11:10 CEST 2011
New submission from Brendan Dolan-Gavitt <brendandg at gatech.edu>:
The default constructor for Maildir is rfc822.Message. This means that when iterating over a Maildir mailbox instantiated with default settings, the Mailbox class will return self._factory(self.get_file(key)), leaking the file descriptor returned by get_file(). Thus, iterating over any reasonably sized maildir mailbox will cause file descriptors to be leaked, and if a non-refcounting GC is used (as in PyPy), it is very likely that the process will run out of file descriptors.
I see that the default has changed to None, for Py3k, but this still means that using a message factory unavoidably leaks file descriptors. Ideally, I'd like the Mailbox class to close the file descriptor passed into the factory; this would mean that file descriptors are never leaked during iteration.
components: Library (Lib)
title: Maildir iterator leaks file descriptors by default
versions: Python 2.5, Python 2.6, Python 2.7
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce