From f874c39f2a93041b65a8461849678acd30a0bfe0 Mon Sep 17 00:00:00 2001 From: William Brown Date: Jun 20 2019 13:22:10 +0000 Subject: Ticket 50439 - fix waitpid issue when pid does not exist Bug Description: In some situations, waitpid will fail with a no child process error, when the pid file has a value but no pid exists. Fix Description: Catch the exception, because in this case we have no pids to wait upon, so there is no harm to skip this. https://pagure.io/389-ds-base/issue/50439 Author: William Brown Review by: ??? --- diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py index 1c57415..c7324f1 100644 --- a/src/lib389/lib389/__init__.py +++ b/src/lib389/lib389/__init__.py @@ -213,7 +213,10 @@ def pid_exists(pid): else: raise # Tell the OS to reap this please ... - os.waitpid(pid, os.WNOHANG) + try: + os.waitpid(pid, os.WNOHANG) + except ChildProcessError: + pass return True def pid_from_file(pidfile):