Comment 11 for bug 872558

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/10924
Committed: http://github.com/openstack/nova/commit/9206ee5a63a65e076342896e3b41bbcbf819af56
Submitter: Jenkins
Branch: master

commit 9206ee5a63a65e076342896e3b41bbcbf819af56
Author: Stanislaw Pitucha <email address hidden>
Date: Mon Aug 6 23:16:07 2012 +0100

    Solve possible race in semaphor creation

    Solve the race condition described in the bug 872558 report which can
    result in:

    - thread crashing trying to remove semaphore from dict
    - two threads getting different semaphores for the same name

    First case is solved automatically by weakref dictionary. No explicit
    deletion takes place.
    The second case is solved by getting existing or new semaphore in one
    step. Once a local reference to the semaphore is obtained, it can be
    safely assigned to the dictionary if it's missing. If it's present, it
    will not be removed anymore because there's at least one strong
    reference present (local variable 'sem').

    This solution is only valid for greenthreads.

    Change-Id: I6bddc3e7abb39fd75e1f03abb2ea0f911b761957