Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent Azure machinery form prematurely deleting machines, leading t…
Browse files Browse the repository at this point in the history
…o sqlalchemy.orm.exc.StaleDataError.
ChrisThibodeaux committed Jul 22, 2024

Verified

This commit was signed with the committer’s verified signature.
djhi Gildas Garcia
1 parent 69dc296 commit d3d751d
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/cuckoo/core/machinery_manager.py
Original file line number Diff line number Diff line change
@@ -297,7 +297,7 @@ def scale_pool(self, machine: Machine) -> None:
def start_machine(self, machine: Machine) -> None:
if (
isinstance(self.machine_lock, ScalingBoundedSemaphore)
and self.db.count_machines_running <= self.machines_limit
and self.db.count_machines_running() <= self.machines_limit
and self.machine_lock._value == 0
):
self.machine_lock.release()
5 changes: 3 additions & 2 deletions modules/machinery/az.py
Original file line number Diff line number Diff line change
@@ -466,8 +466,9 @@ def stop(self, label):
time.sleep(5)
with reimage_lock:
label_in_reimage_vm_list = label in [f"{vm['vmss']}_{vm['id']}" for vm in reimage_vm_list]
else:
self.delete_machine(label)
# TODO: Find a way to enable machine deletion here without causing a sqlalchemy.orm.exc.StaleDataError
# else:
# self.delete_machine(label)

def availables(self, label=None, platform=None, tags=None, arch=None, include_reserved=False, os_version=[]):
"""

0 comments on commit d3d751d

Please sign in to comment.