Robustify locking system (utils.synchronized )
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Stanislaw Pitucha |
Bug Description
As noted by soren, troubles with utils.synchronized :
Scenario:
T1, T2, T3 ; 3 greenthreads executing a function with utils.synchroni
T1 associates a semaphore S to "oof" in _semaphores,
T1 acquires S
T2 get the same semaphore S, wait for S
T1 releases S and remove "oof"/S from _semaphores
T2 acquires S which is no more in _semaphores
scenario first possible ending (not really annoying):
T2 releases S and crash when removing "oof" from semaphores
scenario second possible ending (more annoying):
T3 associates a new semaphore S' to "oof" in _semaphores
T3 acquires S' ... T2 and T3 are doing "oof things at the same time
The attachment contains a test to highlight the first scenario and a proposed implementation solving the trouble.
The proposed implementation of synchronized is based around the class LockByKey.
This class is inspired from the implementation of threading.Semaphore (which i hope is quite robust !).
As far as i test, the proposed implementation supports green threads and native ones.
Changed in nova: | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in nova: | |
assignee: | nobody → Mike Pittaro (mikeyp-3) |
status: | Triaged → In Progress |
Changed in nova: | |
milestone: | none → folsom-3 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | folsom-3 → 2012.2 |
Fix proposed to branch: master /review. openstack. org/4832
Review: https:/