[tracker/wip/carlosg/sandboxed-notifiers: 7/10] trackertestutils: Fix possible race condition in DBus shutdown
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/sandboxed-notifiers: 7/10] trackertestutils: Fix possible race condition in DBus shutdown
- Date: Sat, 20 Feb 2021 22:30:44 +0000 (UTC)
commit 3fbe336e8cbe10bb1ca59aaf2e3f34ed0d15f58d
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Feb 20 23:02:34 2021 +0100
trackertestutils: Fix possible race condition in DBus shutdown
When stopping the DBus service, we don't unset the SIGTERM handler
that tries to stop the DBus service. This results in race conditions
around subprocess.wait().
Remove first the handler, then terminate.
utils/trackertestutils/dbusdaemon.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/utils/trackertestutils/dbusdaemon.py b/utils/trackertestutils/dbusdaemon.py
index 67c947af5..2254902de 100644
--- a/utils/trackertestutils/dbusdaemon.py
+++ b/utils/trackertestutils/dbusdaemon.py
@@ -151,6 +151,9 @@ class DBusDaemon:
#monitor = subprocess.Popen(['dbus-monitor', '--address', self.address])
def stop(self):
+ if self._previous_sigterm_handler:
+ signal.signal(signal.SIGTERM, self._previous_sigterm_handler)
+ self._previous_sigterm_handler = None
if self.process:
log.debug(" Stopping DBus daemon")
self.process.terminate()
@@ -161,9 +164,6 @@ class DBusDaemon:
for thread in self._threads:
thread.join()
self.threads = []
- if self._previous_sigterm_handler:
- signal.signal(signal.SIGTERM, self._previous_sigterm_handler)
- self._previous_sigterm_handler = None
log.debug("DBus daemon stopped")
def pipe_to_log(self, pipe, dbuslog):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]