rudder icon indicating copy to clipboard operation
rudder copied to clipboard

Fixes #28002: User management API has no proper synchronization on parallel requests

Open fanf opened this issue 2 weeks ago • 0 comments

https://issues.rudder.io/issues/28002

So, we have several piece of code that interacts with the user files. All must be guarded by the same semaphore. We also have sometime several methods that are parts of the same bigger action on an user, and each interact with the file, like (pseudo-code):

for {
   _       <- modifyUser(...) // change things in the file
   users <- reload() // read the modified file
} yield modifiedUserFrom(users)

So, we can't just have one semaphore used in each individual method, it needs to be the same atomic context.

In ZIO, we have scope for exactly that reason. The PR add the fact that each bit interacting with the file need to be done in the context of a scope, the scope is provided by the semaphore. In addition, that allows to have the compiler pointing out where we need to guard things.

fanf avatar Dec 11 '25 21:12 fanf