Parcel calculation race condition #189
Labels
No Label
backlog
bug
duplicate
enhancement
feature
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
in discussion
invalid
priority
1
priority
2
priority
3
priority
4
priority
5
question
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: IT-Naturschutz/konova#189
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Status quo
Parcel calculation runs in parallel celery worker processes. This ensures the calculation is performed on a background process, which does not delay the response of the client's foreground process, resulting in an unsatisfying user experience.
However, if a lot of calculations are performed at the same time (e.g. during migration but also possible on mass insertion via API), the same parcel could be created on the used
get_or_create
method by two different worker processes.This results in a duplicates parcel entry. The next worker running
get_or_create
will fetch two different entries, which are basically identical. This will break the logic, since this is not supposed to happen.Enhancement
The
get_or_create
calls have to live in a mutexed method, so each getting-or-creating call will not run parallel but serial. There is a handy tutorial on the official celery documentation regarding this issue: https://docs.celeryq.dev/en/latest/tutorials/task-cookbook.htmlWe should implement this!
Merged in #193