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
This commit is contained in:
James E. Blair 2021-07-15 13:58:07 -07:00
parent ea6e56a312
commit 4dabbd9502
1 changed files with 1 additions and 1 deletions

View File

@ -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