ia64/xen-unstable

changeset 13075:c38370be1e0e

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>
author Brendan Cully <brendan@cs.ubc.ca>
date Wed Dec 13 17:45:50 2006 -0800 (2006-12-13)
parents 63e72c3254da
children fb6db3c9ae74
files tools/python/xen/xend/XendCheckpoint.py
line diff
     1.1 --- a/tools/python/xen/xend/XendCheckpoint.py	Sat Dec 16 12:49:23 2006 +0000
     1.2 +++ b/tools/python/xen/xend/XendCheckpoint.py	Wed Dec 13 17:45:50 2006 -0800
     1.3 @@ -218,18 +218,17 @@ def forkHelper(cmd, fd, inputHandler, cl
     1.4                      log.debug('%s', line)
     1.5                      inputHandler(line, child.tochild)
     1.6  
     1.7 -            thread.join()
     1.8 -
     1.9          except IOError, exn:
    1.10              raise XendError('Error reading from child process for %s: %s' %
    1.11                              (cmd, exn))
    1.12      finally:
    1.13          child.fromchild.close()
    1.14 -        child.childerr.close()
    1.15          if not closeToChild:
    1.16              child.tochild.close()
    1.17 +        thread.join()
    1.18 +        child.childerr.close()
    1.19 +        status = child.wait()
    1.20  
    1.21 -    status = child.wait()
    1.22      if status >> 8 == 127:
    1.23          raise XendError("%s failed: popen failed" % string.join(cmd))
    1.24      elif status != 0: