Problems with DB objects on a multithreaded scenario
|Reported by:||claudio.marinozzi@…||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Severity:||Keywords:||multi thread db|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Discussion topic that started here in Django Developers
There are some critical functions like get_or_create, create, delete, add, remove, etc. that if used in a multithreaded scenario could be crash or "damage data" (some samples in the discussion above) when working on same DB-data, or even not, at the same time.
These operations should be serialized (mutexed) or something like that.
I attach a diff file containing the quick, but working, solution. It's a decorated function used on those critical functions that does the mutex thing. Maybe the decoration should be added to some other functions too. Still don't know Django that good.
Change History (9)
Changed 8 years ago by claudio.marinozzi@…
comment:1 Changed 8 years ago by ubernostrum
- Needs documentation unset
- Needs tests unset
- Patch needs improvement set
comment:3 Changed 8 years ago by Simon G <dev@…>
- Has patch set
- Triage Stage changed from Unreviewed to Accepted