Commit 6d20dfda authored by alina's avatar alina

bugfix: in protocol.clean() waitpid was being call for defunc pids also.

parent 84a3f136
...@@ -98,16 +98,26 @@ class Server(object): ...@@ -98,16 +98,26 @@ class Server(object):
os.kill(pid, signal.SIGTERM) os.kill(pid, signal.SIGTERM)
now = time.time() now = time.time()
while time.time() - now < KILL_WAIT: while time.time() - now < KILL_WAIT:
ch = [pid for pid in self._children ch = []
if not netns.subprocess_.poll(pid)] for pid in self._children:
try:
if not netns.subprocess_.poll(pid):
ch.append(pid)
except OSError, e:
if e.errno != errno.ECHILD:
raise e
if not ch: if not ch:
break break
time.sleep(0.1) time.sleep(0.1)
for pid in ch: for pid in ch:
warning("Killing forcefully process %d." % pid) warning("Killing forcefully process %d." % pid)
os.kill(pid, signal.SIGKILL) os.kill(pid, signal.SIGKILL)
for pid in self._children: for pid in ch:
netns.subprocess_.poll(pid) try:
netns.subprocess_.poll(pid)
except OSError, e:
if e.errno != errno.ECHILD:
raise e
for f in self._xauthfiles.values(): for f in self._xauthfiles.values():
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment