[New-bugs-announce] [issue11767] Maildir iterator leaks file descriptors by default

Brendan Dolan-Gavitt 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)
messages: 132988
nosy: moyix
priority: normal
severity: normal
status: open
title: Maildir iterator leaks file descriptors by default
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11767>
_______________________________________


More information about the New-bugs-announce mailing list