1. Michael Bayer
  2. dogpile.cache
  3. Issues
Issue #97 resolved

NullLock.acquire takes exactly 1 argument (2 given)

Jamie Lennox
created an issue

So this is a transient bug in a keystone deployment i'm working on that i haven't figured out the source of yet, however the fix i think is reasonably clear.

The Null cache backed's NullLock.acquire does not accept any arguments [1] however it's called with wait=True [2] and so gives a ValueError. I'm not sure how this went unnoticed for so long or why I'm only seeing it on some runs, but the acquire function should definitely be accepting the wait parameter like other lock implementations.

[1] https://bitbucket.org/zzzeek/dogpile.cache/src/87965ada186f9b3a4eb7ff033a2e31437d5e9bc6/dogpile/cache/backends/null.py?at=master&fileviewer=file-view-default#null.py-20

[2] https://bitbucket.org/zzzeek/dogpile.core/src/e9011d84952fda433b45bd4e0ef7a11bd764f582/dogpile/core/dogpile.py?at=master&fileviewer=file-view-default#dogpile.py-122

Comments (2)

  1. Michael Bayer repo owner

    NullLock.acquire should accept wait parameter, return boolean

    The interface for acquiring locks specifies that they should accept and default to wait=True. NullLock wasn't implementing this correctly. Additionally, the acquire() function needs to return a boolean value to indicate that the lock was acquired (which in the case of NullLock is unconditional).

    Fixes: #97

    Change-Id: I45487cd602b562242e425395728a9ed7e78d797e Pull-request: https://bitbucket.org/zzzeek/dogpile.cache/pull-requests/50

    → <<cset 97add35012d9>>

  2. Log in to comment