From 8ac7644ff2521ccba757e680068c5a9f87f78ed0 Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.anjos@idiap.ch>
Date: Fri, 20 May 2016 13:19:18 +0200
Subject: [PATCH] [backend] Ignore zombie processes that are gone

---
 beat/web/backend/models.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/beat/web/backend/models.py b/beat/web/backend/models.py
index 43abb9b55..de1b55021 100644
--- a/beat/web/backend/models.py
+++ b/beat/web/backend/models.py
@@ -171,8 +171,12 @@ def _cleanup_zombies():
     '''Cleans-up eventual zombie subprocesses launched by the worker'''
 
     for child in psutil.Process().children(recursive=True):
-        if child.status() == psutil.STATUS_ZOMBIE:
-            child.wait()
+        try:
+            if child.status() == psutil.STATUS_ZOMBIE:
+                child.wait()
+        except psutil.NoSuchProcess:
+            # process is gone meanwhile, which is ok
+            pass
 
 
 class WorkerManager(models.Manager):
-- 
GitLab