Shared cache implementation currently takes a lock, checks whether item is absent, releases the lock, takes the lock again, and only then inserts the item.
The problem is that in some scenarios another call to the same function can come in between those operations and take the lock, leading to racing errors.
It should instead hold the lock for the duration of the entire function.
Shared cache implementation currently takes a lock, checks whether item is absent, releases the lock, takes the lock again, and only then inserts the item.
The problem is that in some scenarios another call to the same function can come in between those operations and take the lock, leading to racing errors.
It should instead hold the lock for the duration of the entire function.