Hello Milan Zamazal,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/62403

to review the following change.

Change subject: virt: Fix of Executor._active_workers crash on modification
......................................................................

virt: Fix of Executor._active_workers crash on modification

Executor._active_workers doesn't use a lock when accessing
self._workers.  This is intentional, since we access self._workers
read-only, we don't need exact value for some snapshot of the executor
state and we have no reason to impose locking on the method.

However, we still must be careful, because we loop over the value.  If
it gets modified during the loop then

  RuntimeError: Set changed size during iteration

is raised.  This patch prevents that error by making a shallow copy of
self._workers in the loop.

Change-Id: Iaed995109e98c5ab79724a4765c3212140ebebb7
Bug-Url: https://bugzilla.redhat.com/1364925
Backport-To: 4.0
Backport-To: 3.6
Signed-off-by: Milan Zamazal <mzama...@redhat.com>
Reviewed-on: https://gerrit.ovirt.org/61690
Continuous-Integration: Jenkins CI
Reviewed-by: Francesco Romani <from...@redhat.com>
Reviewed-on: https://gerrit.ovirt.org/61770
Tested-by: Francesco Romani <from...@redhat.com>
---
M lib/vdsm/executor.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/62403/1

diff --git a/lib/vdsm/executor.py b/lib/vdsm/executor.py
index 4903a1f..f56b9c5 100644
--- a/lib/vdsm/executor.py
+++ b/lib/vdsm/executor.py
@@ -106,7 +106,7 @@
 
     @property
     def _active_workers(self):
-        return len([w for w in self._workers if not w.discarded])
+        return len([w for w in tuple(self._workers) if not w.discarded])
 
     @property
     def _total_workers(self):


-- 
To view, visit https://gerrit.ovirt.org/62403
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaed995109e98c5ab79724a4765c3212140ebebb7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Francesco Romani <from...@redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzama...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org

Reply via email to