New submission from Brendan Dolan-Gavitt <brenda...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue11767>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to