473,465 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Re: Descriptor leak in python 2.4 subprocess module

Michel Lespinasse wrote:
Hi,

I hit an issue with the following python code:

try:
get_orient = subprocess.Popen (['jpegexiforient', '-n', pathfull],
stdin = subprocess.PIPE,
stdout = subprocess.PIPE)
orient = get_orient.communicate ()[0]
except:
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)?

TJG
Aug 28 '08 #1
0 1189

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Xah Lee | last post by:
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 421 open ( +3) / 3530 closed ( +8) / 3951 total (+11) Bugs : 963 open ( +4) / 6426 closed (+21) / 7389 total (+25) RFE : 255 open...
7
by: Jonathan Fine | last post by:
Hello My problem is that I want a Python 2.4 module on a server that is running Python 2.3. I definitely want to use the 2.4 module, and I don't want to require the server to move to Python...
10
by: bruce | last post by:
hi... can someone point me to where/how i would go about calling a ruby app from a python app, and having the python app being able to get a returned value from the ruby script. something...
0
by: Michel Lespinasse | last post by:
Hi, I hit an issue with the following python code: try: get_orient = subprocess.Popen (, stdin = subprocess.PIPE, stdout = subprocess.PIPE) orient = get_orient.communicate () except:
0
by: Michel Lespinasse | last post by:
On Thu, Aug 28, 2008 at 10:37:48AM +0100, Tim Golden wrote: The root cause is different (subprocess has separate implementations for windows and posix), but the issues are similar. In the posix...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.