[ python-Bugs-897935 ] pty.spawn() leaks file descriptors
SourceForge.net
noreply at sourceforge.net
Sat Jun 5 12:31:52 EDT 2004
Bugs item #897935, was opened at 2004-02-16 06:28
Message generated for change (Comment added) made by akuchling
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=897935&group_id=5470
Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: James Henstridge (jhenstridge)
>Assigned to: A.M. Kuchling (akuchling)
Summary: pty.spawn() leaks file descriptors
Initial Comment:
By running the following short program on Linux, you
can see the number of open file descriptors increase:
import os, pty
for i in range(10):
pty.spawn(['true'])
print len(os.listdir('/proc/%d/fd' % os.getpid()))
This can be fixed by os.close()'ing master_fd. This
problem seems to exist in CVS head as well as 2.3.
There are also a few changes that would be nice to see
in pty.spawn:
1) get the exit status of the child. Could be fixed by
adding the following to the end of the function:
pid, status = os.waitpid(pid, 0)
return status
2) set master_fd to non-blocking mode, so that the
output is printed to the screen at the speed it is
produced by the child.
----------------------------------------------------------------------
>Comment By: A.M. Kuchling (akuchling)
Date: 2004-06-05 12:31
Message:
Logged In: YES
user_id=11375
Closing.
----------------------------------------------------------------------
Comment By: A.M. Kuchling (akuchling)
Date: 2004-06-05 12:30
Message:
Logged In: YES
user_id=11375
I've applied a fix to CVS HEAD; thanks for reporting this!
The two feature suggestions have been added to the RFE tracker as
#967161 so that I can close this bug.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=897935&group_id=5470
More information about the Python-bugs-list
mailing list