470,642 Members | 1,493 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,642 developers. It's quick & easy.

Re: Descriptor leak in python 2.4 subprocess module

Michel Lespinasse wrote:

I hit an issue with the following python code:

get_orient = subprocess.Popen (['jpegexiforient', '-n', pathfull],
stdin = subprocess.PIPE,
stdout = subprocess.PIPE)
orient = get_orient.communicate ()[0]
orient = None

The intent of this was to read the exif orientation of a picture, or just
use None if jpegexiforient can not run.

The application worked fine on my devel machine but I noticed that on a
different host, it crashed due to running out of file descriptors.
After investigation I found out that the above code was responsible,
leaking two file descriptors per invocation if jpegexiforient is not
installed on the host.

I don't see any way to fix it in my code either, since get_orient is not
defined in the exception path, there is no way I can close its file
descriptors myself. I believe this is a bug in the subprocess module,
it should make sure to clean up after itself when getting out on the
exception path.

This looks like a duplicate of http://bugs.python.org/issue3210.
Can you confirm if this seems likely (and, if so, perhaps add
a note to the bug indicating that the problem is on Linux as well)?

Aug 28 '08 #1
0 1080

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Xah Lee | last post: by
reply views Thread by Kurt B. Kaiser | last post: by
7 posts views Thread by Jonathan Fine | last post: by
10 posts views Thread by bruce | last post: by
reply views Thread by Michel Lespinasse | last post: by
reply views Thread by Michel Lespinasse | last post: by
2 posts views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.