From fa784018d0e5fda8917d56ec27ffe7978608bcd6 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Sat, 4 Nov 2023 11:33:52 +0200 Subject: [PATCH 1/2] Fix GT job creation races --- cvat/apps/engine/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cvat/apps/engine/serializers.py b/cvat/apps/engine/serializers.py index edc9ad5709e7..ba8a8f1bb82f 100644 --- a/cvat/apps/engine/serializers.py +++ b/cvat/apps/engine/serializers.py @@ -620,7 +620,7 @@ def to_representation(self, instance): @transaction.atomic def create(self, validated_data): task_id = validated_data.pop('task_id') - task = models.Task.objects.get(pk=task_id) + task = models.Task.objects.select_for_update().get(pk=task_id) if validated_data["type"] == models.JobType.GROUND_TRUTH: if not task.data: From e9d021234dd5649ae927c390f48951b379236fd4 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Sat, 4 Nov 2023 11:39:50 +0200 Subject: [PATCH 2/2] Add changelog entry --- changelog.d/20231104_113802_mzhiltsov_fix_atomic_uses.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelog.d/20231104_113802_mzhiltsov_fix_atomic_uses.md diff --git a/changelog.d/20231104_113802_mzhiltsov_fix_atomic_uses.md b/changelog.d/20231104_113802_mzhiltsov_fix_atomic_uses.md new file mode 100644 index 000000000000..0c7e9d02f966 --- /dev/null +++ b/changelog.d/20231104_113802_mzhiltsov_fix_atomic_uses.md @@ -0,0 +1,4 @@ +### Fixed + +- Data race condition during GT job creation + ()