[ python-Bugs-933670 ] pty.fork() leaves slave fd's open on Solaris
SourceForge.net
noreply at sourceforge.net
Mon Apr 12 10:21:38 EDT 2004
Bugs item #933670, was opened at 2004-04-12 10:21
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=933670&group_id=5470
Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Scott Lowrey (slowrey)
Assigned to: Nobody/Anonymous (nobody)
Summary: pty.fork() leaves slave fd's open on Solaris
Initial Comment:
On a Solaris 2.8 system, slave file descriptors are
left open after the child process is gone and the
master has been closed.
The pty.fork() function attempts to use os.forkpty()
first. When that fails (apparently the os module does
not provide forkpty() on Solaris?), it uses openpty()
and os.fork(). openpty() returns master and slave file
descriptors. Since pty.fork() only returns the
master_fd, it is not clear to me how the slave would
ever be closed since the caller doesn't have access to
it. Perhaps pty.fork is supposed to take care of this?
I am using pexpect to control my pty's, so I don't have
much expertise in this area other than what I've
gleaned from the code.
At any rate, on a long running process used to test
other programs, the open file descriptors pile up until
the ulimit is reached. I've worked around this by
modifying pexpect.close() to use os.close(self.child_fd
+ 1). A hack, I'm sure... :)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=933670&group_id=5470
More information about the Python-bugs-list
mailing list