cea-hpc/clustershell — Issue #121: Pipe leak
Author: thiell
Created: 2012-03-03 16:47:59+00:00
State: open
Labels: Lib/Worker

Pipes created by the Popen worker are not freed.
Using lsof, it is clear that pipes are created but never closed.
By the way, adding in the Popen.py module the following instructions:

{{{
#!python
def _close(self, force, timeout):
"""
Close worker. Called by engine after worker has been
unregistered. This method should handle all termination types
(normal, forced or on timeout).
"""
if not force and self._rbuf:
# We still have some read data available in buffer, but no
# EOL. Generate a final message before closing.
self.worker._on_msgline(self._rbuf)

rc = -1
if force or timeout:
# check if process has terminated
prc = self.popen.poll()
if prc is None:
# process is still running, kill it
os.kill(self.popen.pid, signal.SIGKILL)
else:
# close process / check if it has terminated
prc = self.popen.wait()
# get exit status
if prc >= 0:
# process exited normally
rc = prc
else:
# if process was signaled, return 128 + signum (bash-like)
rc = 128 + -prc

--> print("CLOSING STDIN and STDOUT")
self.popen.stdin.close()
self.popen.stdout.close()
}}}

The string "{{{CLOSING STDIN and STDOUT}}}" never appears.