lockutils - native threads support

Bug #1065529 reported by Mark McLoughlin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo-incubator
Fix Released
Medium
Victor Stinner

Bug Description

https://review.openstack.org/14139

This piece of code:

            sem = _semaphores.get(name, semaphore.Semaphore())
            if name not in _semaphores:
                # this check is not racy - we're already holding ref locally
                # so GC won't remove the item and there was no IO switch
                # (only valid in greenthreads)
                _semaphores[name] = sem

assumes that we're using greenthreads and not native threads

We should support native threads soon

This:

  http://stackoverflow.com/questions/5390569/dynamically-allocating-and-destroying-mutexes

shows how we can fix that by protecting the semaphores dict with a lock

Mark McLoughlin (markmc)
affects: openstack-common → oslo
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

Fix proposed to branch: master
Review: https://review.openstack.org/54581

Changed in oslo:
assignee: nobody → Victor Stinner (victor-stinner)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/54581
Committed: http://github.com/openstack/oslo-incubator/commit/79e6bc6cbb2288b82c587ae3a19a41540647886d
Submitter: Jenkins
Branch: master

commit 79e6bc6cbb2288b82c587ae3a19a41540647886d
Author: Victor Stinner <email address hidden>
Date: Wed Oct 30 17:26:21 2013 +0100

    fix lockutils.lock() to make it thread-safe

    lockutils.lock() is currenctly safe when used with greenthreads, but it is not
    safe when used with classic threads. This change uses a lock to protect
    _semaphores dictionary.

    Change-Id: Ia18e6e9f9a1353640729ac57d7225c660159cd55
    Closes-Bug: 1065529

Changed in oslo:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in oslo:
milestone: none → icehouse-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
milestone: icehouse-1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.