Browse Source

Moving task cache update into task creation transaction

Doing this we avoid inclusion of task cache update statement into the next
transaction which may cause different problems such as deadlock.
In this particular case we've got the following deadlock:
1. DeleteIBPImagesTask makes UPDATE tasks SET cache....
2. Response handler in receiver makes SELECT clusters FOR UPDATE
3. The code following DeleteIBPImagesTask makes SELECT clusters FOR UPDATE
4. Response handler performs SELECTS tasks FOR UPDATE

Change-Id: Ic8e5f2386364421b0667f920499e031f587f726e
Closes-Bug: #1653083
Georgy Kibardin 2 years ago
parent
commit
ff04eb8394
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      nailgun/nailgun/task/task.py

+ 2
- 1
nailgun/nailgun/task/task.py View File

@@ -909,8 +909,9 @@ class DeleteIBPImagesTask(object):
909 909
     def execute(cls, cluster, image_data):
910 910
         task = Task(name=consts.TASK_NAMES.remove_images, cluster=cluster)
911 911
         db().add(task)
912
+        message = cls.message(task, image_data)
912 913
         db().commit()
913
-        rpc.cast('naily', cls.message(task, image_data))
914
+        rpc.cast('naily', message)
914 915
 
915 916
 
916 917
 class StopDeploymentTask(object):

Loading…
Cancel
Save