Brendan Cully
2006-Dec-14 00:46 UTC
[Xen-devel] [PATCH] Improve XendCheckpoint''s forkHelper error handling
# HG changeset patch # User Brendan Cully <brendan@cs.ubc.ca> # Date 1166060750 28800 # Node ID f2e7504c6693b80c98bb0b5368f3f7a4e5021333 # Parent 147608edc24993eaff17fd57709c77b8e2fee6b2 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> diff -r 147608edc249 -r f2e7504c6693 tools/python/xen/xend/XendCheckpoint.py --- a/tools/python/xen/xend/XendCheckpoint.py Wed Dec 13 17:42:38 2006 -0800 +++ b/tools/python/xen/xend/XendCheckpoint.py Wed Dec 13 17:45:50 2006 -0800 @@ -224,18 +224,17 @@ def forkHelper(cmd, fd, inputHandler, cl 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() - - status = child.wait() + thread.join() + child.childerr.close() + status = child.wait() + if status >> 8 == 127: raise XendError("%s failed: popen failed" % string.join(cmd)) elif status != 0: _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Brendan Cully
2006-Dec-16 04:46 UTC
Re: [Xen-devel] [PATCH] Improve XendCheckpoint''s forkHelper error handling
On Wednesday, 13 December 2006 at 17:46, Brendan Cully wrote:> # HG changeset patch > # User Brendan Cully <brendan@cs.ubc.ca> > # Date 1166060750 28800 > # Node ID f2e7504c6693b80c98bb0b5368f3f7a4e5021333 > # Parent 147608edc24993eaff17fd57709c77b8e2fee6b2 > 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>*bump* it''s pretty easy to wedge xend without this patch. Just have migrateDevices return an error code, eg by running an external-device-migrate script that returns 1. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ewan Mellor
2006-Dec-16 12:51 UTC
Re: [Xen-devel] [PATCH] Improve XendCheckpoint''s forkHelper error handling
On Wed, Dec 13, 2006 at 05:46:12PM -0700, Brendan Cully wrote:> # HG changeset patch > # User Brendan Cully <brendan@cs.ubc.ca> > # Date 1166060750 28800 > # Node ID f2e7504c6693b80c98bb0b5368f3f7a4e5021333 > # Parent 147608edc24993eaff17fd57709c77b8e2fee6b2 > 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>Applied, thanks Brendan, and sorry about the delay. Ewan. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel