Browse Source

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
changes/94/800994/1
James E. Blair 2 months ago
parent
commit
4dabbd9502
  1. 2
      zuul/nodepool.py

2
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

Loading…
Cancel
Save