LocMem cache may cause deadlocks
|Reported by:||Rafal Stozek||Owned by:||nobody|
|Component:||Core (Cache system)||Version:||master|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
LocMem cache uses locks to synchronize access to the cache dict.
The problem is that pickle dumps/loads is executed inside code blocks which acquired a reader/writer lock. Pickle dumps/loads can execute parts of user's code to accomplish it's task. The problem starts when user's code tries to retrieve something from the cache.
In that situation for example set() acquires a lock, calls pickle.dumps() which calls user's code, which calls get(), which tries to acquire a lock - causing a deadlock. Very rare situation but it does happen.
Change History (7)
comment:3 Changed 3 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Unreviewed → Accepted|