aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrendan Cully <brendan@cs.ubc.ca>2006-12-13 17:45:50 -0800
committerBrendan Cully <brendan@cs.ubc.ca>2006-12-13 17:45:50 -0800
commit24a6ed484bf95f363a52b226e1edcd775eef1812 (patch)
tree55c85002b3ab11ae3e950780514625fca768cc4e
parent0a38a347b755a496b16302db1bd4469d402894db (diff)
downloadxen-24a6ed484bf95f363a52b226e1edcd775eef1812.tar.gz
xen-24a6ed484bf95f363a52b226e1edcd775eef1812.tar.bz2
xen-24a6ed484bf95f363a52b226e1edcd775eef1812.zip
Improve XendCheckpoint's forkHelper error handling.
When inputHandler raises an exception, close stdin and stdout in the child before attempting to close stderr, which is held open by a separate thread. Without this patch, exceptions raised by device migration caused xend to hang on child.childerr.close(). Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
-rw-r--r--tools/python/xen/xend/XendCheckpoint.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/python/xen/xend/XendCheckpoint.py b/tools/python/xen/xend/XendCheckpoint.py
index 21a323cdcc..85a59e5d22 100644
--- a/tools/python/xen/xend/XendCheckpoint.py
+++ b/tools/python/xen/xend/XendCheckpoint.py
@@ -218,18 +218,17 @@ def forkHelper(cmd, fd, inputHandler, closeToChild):
log.debug('%s', line)
inputHandler(line, child.tochild)
- thread.join()
-
except IOError, exn:
raise XendError('Error reading from child process for %s: %s' %
(cmd, exn))
finally:
child.fromchild.close()
- child.childerr.close()
if not closeToChild:
child.tochild.close()
+ thread.join()
+ child.childerr.close()
+ status = child.wait()
- status = child.wait()
if status >> 8 == 127:
raise XendError("%s failed: popen failed" % string.join(cmd))
elif status != 0: