[CRIU] [PATCH] zdtm: show a process tree if a test doesn't show signs of life

Andrei Vagin avagin at virtuozzo.com
Thu Mar 23 15:12:09 PDT 2017


Applied

On Tue, Mar 21, 2017 at 02:30:23AM +0300, Andrei Vagin wrote:
> From: Andrei Vagin <avagin at virtuozzo.com>
> 
> Call "ps axf" if waitpid() is running more than 10 seconds
> 
> Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
> ---
>  test/zdtm.py | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/test/zdtm.py b/test/zdtm.py
> index 57e2ab0..bd82a60 100755
> --- a/test/zdtm.py
> +++ b/test/zdtm.py
> @@ -27,6 +27,13 @@ os.chdir(os.path.dirname(os.path.abspath(__file__)))
>  prev_line = None
>  
>  
> +def alarm(*args):
> +	print "==== ALARM ===="
> +
> +
> +signal.signal(signal.SIGALRM, alarm)
> +
> +
>  def traceit(f, e, a):
>  	if e == "line":
>  		lineno = f.f_lineno
> @@ -1473,7 +1480,22 @@ class launcher:
>  			self.wait()
>  
>  	def __wait_one(self, flags):
> -		pid, status = os.waitpid(0, flags)
> +		pid = -1
> +		status = -1
> +		signal.alarm(10)
> +		while True:
> +			try:
> +				pid, status = os.waitpid(0, flags)
> +			except OSError, e:
> +				if e.errno == errno.EINTR:
> +					subprocess.Popen(["ps", "axf"]).wait()
> +					continue
> +				signal.alarm(0)
> +				raise e
> +			else:
> +				break
> +		signal.alarm(0)
> +
>  		self.__runtest += 1
>  		if pid != 0:
>  			sub = self.__subs.pop(pid)
> -- 
> 2.7.4
> 


More information about the CRIU mailing list