From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has uploaded a new change for review.
Change subject: netlink: monitor: join scanner thread on __exit__
......................................................................
netlink: monitor: join scanner thread on __exit__
In case a timeout occurs, the _scan() function ultimately ends, but
nothing explicitly waits on its control thread. It is harmless in the
case of netlink.monitor, but it is impolite to leak threads, even for a
short while.
This patch explicitly waits for the scan thread to finish before exiting
from an event monitor context manager.
The issue was spotted by running the tests with --countthreads.
Change-Id: I9dd0097ad8d6ba5288e27b8f02bc62fc562030e9
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M lib/vdsm/network/netlink/monitor.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/69041/1
diff --git a/lib/vdsm/network/netlink/monitor.py b/lib/vdsm/network/netlink/monitor.py
index 089c1ec..fc538e0 100644
--- a/lib/vdsm/network/netlink/monitor.py
+++ b/lib/vdsm/network/netlink/monitor.py
@@ -124,6 +124,7 @@
def __exit__(self, groups, timeout, silent_timeout):
if not self.is_stopped():
self.stop()
+ self._scan_thread.join()
def start(self):
if self._timeout:
@@ -168,7 +169,6 @@
self._scanning_stopped.set()
self._scanning_started.wait()
os.write(self._pipetrick[1], b'c')
- self._scan_thread.join()
def is_stopped(self):
return self._scanning_stopped.is_set()
--
To view, visit
https://gerrit.ovirt.org/69041
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9dd0097ad8d6ba5288e27b8f02bc62fc562030e9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>