From 4dabbd9502a5b1e59920a317c9870c1e4d707e04 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 15 Jul 2021 13:58:07 -0700 Subject: [PATCH] Fix race when canceling a node request When we cancel a node request, we delete the request from ZK. We might get the callback from ZK to update the node request object (due to the delete event) in a seprate thread while the first thread is between the lines where we delete the request and set the internal flag indicating it was canceled. That would cause the update callback to think that the request was externally deleted (not by us) and resubmit it. To correct this, set the internal canceled flag before performing the ZK delete. Change-Id: I1b4771b5840cb168b01939bd8590534ef618d878 --- zuul/nodepool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zuul/nodepool.py b/zuul/nodepool.py index b5b3048a24..0cdeb4060a 100644 --- a/zuul/nodepool.py +++ b/zuul/nodepool.py @@ -143,10 +143,10 @@ class Nodepool(object): log.info("Canceling node request %s", request) if not request.canceled: try: + request.canceled = True self.zk_nodepool.deleteNodeRequest(request) except Exception: log.exception("Error deleting node request:") - request.canceled = True def reviseRequest(self, request, relative_priority=None): '''Attempt to update the node request, if it is not currently being