diff options
author | Jeffrey Zhang <zhang.lei.fly@gmail.com> | 2019-10-28 21:26:59 +0800 |
---|---|---|
committer | Jeffrey Zhang <zhang.lei.fly@gmail.com> | 2019-11-10 23:50:28 +0000 |
commit | c9a57aab082f55d525f003db61290b6ab7437b7c (patch) | |
tree | c704ad696c7a1843c07e656fd45fc3d79a5f3e3f /oslo_rootwrap/client.py | |
parent | c6babc72223b1be3c01c0d9fa80d5267d92f93c7 (diff) | |
download | oslo-rootwrap-c9a57aab082f55d525f003db61290b6ab7437b7c.tar.gz |
reap rootwrap daemon process when it is timeout
When the daemon process is timeout, it will kill itself. But the parent
doesn't reap it. This patch add a thread to wait the process to be done
once the daemon is started.
Closes-Bug: #1850241
Change-Id: Ic209b8ef86c2522ce7e4bd81ac57bf13f1706a81
Diffstat (limited to 'oslo_rootwrap/client.py')
-rw-r--r-- | oslo_rootwrap/client.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/oslo_rootwrap/client.py b/oslo_rootwrap/client.py index ee64b74..0dd0742 100644 --- a/oslo_rootwrap/client.py +++ b/oslo_rootwrap/client.py @@ -85,6 +85,15 @@ class Client(object): (stderr,)) LOG.info("Spawned new rootwrap daemon process with pid=%d", process_obj.pid) + + def wait_process(): + return_code = process_obj.wait() + LOG.info("Rootwrap daemon process exit with status: %d", + return_code) + + reap_process = threading.Thread(target=wait_process) + reap_process.daemon = True + reap_process.start() self._manager = ClientManager(socket_path, authkey) self._manager.connect() self._proxy = self._manager.rootwrap() |