[openstack-dev] [oslo][concurrency] lockutils lock fairness / starvation

Joshua Harlow harlowja at fastmail.com
Tue May 16 22:04:54 UTC 2017

Chris Friesen wrote:
> On 05/16/2017 10:45 AM, Joshua Harlow wrote:
>> So fyi,
>> If you really want something like this:
>> Just use:
>> http://fasteners.readthedocs.io/en/latest/api/lock.html#fasteners.lock.ReaderWriterLock
>> And always get a write lock.
>> It is a slightly different way of getting those locks (via a context
>> manager)
>> but the implementation underneath is a deque; so fairness should be
>> assured in
>> FIFO order...
> That might work as a local patch, but doesn't help the more general case
> of fair locking in OpenStack. The alternative to adding fair locks in
> oslo would be to add fairness code to all the various OpenStack services
> that use locking, which seems to miss the whole point of oslo.

Replace 'openstack community' with 'python community'? ;)

> In the implementation above it might also be worth using one condition
> variable per waiter, since that way you can wake up only the next waiter
> in line rather than waking up everyone only to have all-but-one of them
> go back to sleep right away.

Ah good idea, I'll see about doing/adding/changing that.


More information about the OpenStack-dev mailing list