Skip to content

Review thread safety of state in API and client #64

Description

@toddbaert

I'd like to review the thread safety of the SDK to make sure we don't have potential concurrency issues, particularly around state maintained in the global API object or clients. I'd like to confirm we have the required safeguards around the context, hooks, or any other state on these objects.

We may need some constraints or synchronization around setting context, hooks, etc.

Let's use this issue to investigate and discuss some of these.

UPDATE: after lots of discussion here and the recent changes here to make Context an interface, I think the basic outline of what needs to be done to resolve thread safety issues is:

  • create an immutable implementation of EvaluationContext
  • create a read/write lock on the global provider, global hooks, and the client hooks that allows n threads to read and 1 to write
  • document thread safety in general, particularly use of the ImmutableContext.

cc @justinabrahms @kinyoklion @thomaspoignant

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions