Open toddbaert opened 1 year ago
@matthewelwell @hlipsig @tcarrio do we need to worry about locking/concurrency here? I know there's a threading
module in Python. Are any locks necessary, especially around global state? From our meeting if sounds like this might not be necessary, but I have limited Python experience and can't say...
Hey @federicobond perhaps you could answer this question. Do we need to be concerned about threading issues?
I'd have to take a closer look at it. The GIL has us covered in some cases for simple assignments but anything more complex than that should probably be guarded by a lock.
add_hooks
is probably not thread-safe due to read-update-write race conditions when concatenating lists.
set_provider
used to be thread safe but likely isn't now with the new shutdown and initialize logic.
Review the thread safety of the SDK to make sure there's no potential concurrency issues, particularly around state maintained in the global API object, clients, and evaluation context objects.
See here for a similar discussion in the Java SDK and others.
Definition of done: