Skip to content

get_or_set(): Dogpile lock has no timeout #128

@lraucy

Description

@lraucy

In the get_or_set() implementation, the dogpile lock never expires. In some edge cases it can creates some issues, here is an example:

  • L410: value is None -> we create a dogpile lock
  • L424: for some reason, the expire never succeeded (for instance, the client failed to get a connection in the connection pool: I believe this is what happened in my particular case)

In this particular case, the Redis cache is in a state where the dogpile lock will never get released: evert future calls to get_or_set() will return None, until someone manually releases the lock. This is not simple to debug for someone not familiar with the dogpile lock, and worst, it requires manual action to return to a "clean" state.

To avoid that I'd like to add an extra argument dogpile_timeout to the get_or_set value. I'll work on a PR to add that feature, but I'd be happy to have opinions about this idea first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions