Change in vdsm[master]: executor: Fix race when putting tasks

danken at redhat.com danken at redhat.com
Sun Jul 19 20:44:15 UTC 2015


Dan Kenigsberg has submitted this change and it was merged.

Change subject: executor: Fix race when putting tasks
......................................................................


executor: Fix race when putting tasks

When putting tasks into a TaskQueue, we used check the current number of
tasks in a thread-unsafe way.  We assume that the thread-unsafe check
can result in the worst case in few extra tasks in the task queue, which
is not very interesting.

However, if all workers are busy, and the task queue is almost full, it
is possible that two threads will pass the size check, and the queue
will contain more tasks then the maximum value. Once the queue size
exceeded the limit, we allow any number of additional tasks.

While this condition is unlikely, there is not reason to allow this
behavior. Now we check the queue size in a thread safe way and we don't
have to maintain the comment about the possible race.

Since we take the condition anyway on every put, I don't expect a
noticeable performance differences by taking the condition before the
size check.

Change-Id: Ie9ce28985e18629abb812e05752df90d05800c86
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/43789
Continuous-Integration: Jenkins CI
Reviewed-by: Francesco Romani <fromani at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M lib/vdsm/executor.py
1 file changed, 3 insertions(+), 6 deletions(-)

Approvals:
  Nir Soffer: Verified
  Jenkins CI: Passed CI tests
  Dan Kenigsberg: Looks good to me, approved
  Francesco Romani: Looks good to me, but someone else must approve



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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie9ce28985e18629abb812e05752df90d05800c86
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org


More information about the vdsm-patches mailing list