Nir Soffer has submitted this change and it was merged. Change subject: virt: Improve thread safety of discarding executor workers ......................................................................
virt: Improve thread safety of discarding executor workers Current implementation of executor is not completely thread safe. Consider the following scenario that might happen in theory: - _execute_task cancels discard timer but the timer is already starting discard processing. - However `self._discarded = True' statement hasn't been reached yet. - _execute_task sees self._discarded as False and continues with processing normally. - _run continues with another task. - _discard is executed in the meantime. - The other processed task stalls and discard processing is initiated again. - _discard checks for self._discarded (which is True now) and raises AssertionError. The primary problem is coordination between worker and scheduler threads, namely between finishing task execution and possible asynchronous discard of the worker due to a timeout. This patch solves that problem by introducing a lock ensuring that once _execute_task decides to finish the task regularly, no discard processing of the given task may be performed anymore. Change-Id: I3a4cec1a4b3c1e1aa341d90c0e02f46d0b776e9c Signed-off-by: Milan Zamazal <[email protected]> Reviewed-on: https://gerrit.ovirt.org/58146 Reviewed-by: Piotr Kliczewski <[email protected]> Reviewed-by: Francesco Romani <[email protected]> Reviewed-by: Nir Soffer <[email protected]> Continuous-Integration: Jenkins CI --- M lib/vdsm/executor.py M lib/vdsm/schedule.py 2 files changed, 32 insertions(+), 6 deletions(-) Approvals: Piotr Kliczewski: Looks good to me, but someone else must approve Nir Soffer: Looks good to me, approved Jenkins CI: Passed CI tests Francesco Romani: Looks good to me, but someone else must approve Milan Zamazal: Verified -- To view, visit https://gerrit.ovirt.org/58146 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3a4cec1a4b3c1e1aa341d90c0e02f46d0b776e9c Gerrit-PatchSet: 12 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Milan Zamazal <[email protected]> Gerrit-Reviewer: Francesco Romani <[email protected]> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Martin Polednik <[email protected]> Gerrit-Reviewer: Milan Zamazal <[email protected]> Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: Piotr Kliczewski <[email protected]> Gerrit-Reviewer: gerrit-hooks <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/admin/lists/[email protected]
