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:
parent
ea6e56a312
commit
4dabbd9502
|
@ -143,10 +143,10 @@ class Nodepool(object):
|
||||||
log.info("Canceling node request %s", request)
|
log.info("Canceling node request %s", request)
|
||||||
if not request.canceled:
|
if not request.canceled:
|
||||||
try:
|
try:
|
||||||
|
request.canceled = True
|
||||||
self.zk_nodepool.deleteNodeRequest(request)
|
self.zk_nodepool.deleteNodeRequest(request)
|
||||||
except Exception:
|
except Exception:
|
||||||
log.exception("Error deleting node request:")
|
log.exception("Error deleting node request:")
|
||||||
request.canceled = True
|
|
||||||
|
|
||||||
def reviseRequest(self, request, relative_priority=None):
|
def reviseRequest(self, request, relative_priority=None):
|
||||||
'''Attempt to update the node request, if it is not currently being
|
'''Attempt to update the node request, if it is not currently being
|
||||||
|
|
Loading…
Reference in New Issue