Skip to content

Race condition in BasicLifecycler #284

@jhalterman

Description

@jhalterman

There's a small race condition in BasicLifecycler where concurrent calls to updateInstance could cause a lost update if the ordering of calls changes after l.store.CAS and before updating l.currInstanceDesc. Some approaches for guarding against this are:

  • Pessimistic - We can broaden the currState.Lock() to include the CAS call.
  • Optimistic - We can store a currVersion along with currInstanceDesc, update CAS to return the new version, and only update currInstanceDesc if the new version is > currVersion.

We should also consider whether other methods that update l.currInstanceDesc should be similarly guarded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions