diff --git a/eng/Versions.props b/eng/Versions.props index ad6fc740577..d9f3d9d739a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -2,7 +2,7 @@ - 17.11.10release + 17.11.11release 17.10.4 15.1.0.0 servicing diff --git a/src/Build/BackEnd/BuildManager/BuildManager.cs b/src/Build/BackEnd/BuildManager/BuildManager.cs index 99acd7b5ac8..2e1e1827d74 100644 --- a/src/Build/BackEnd/BuildManager/BuildManager.cs +++ b/src/Build/BackEnd/BuildManager/BuildManager.cs @@ -792,15 +792,10 @@ void Callback(object state) { lock (_syncLock) { - if (_shuttingDown) - { - return; - } - - // If we are Idle, obviously there is nothing to cancel. If we are waiting for the build to end, then presumably all requests have already completed - // and there is nothing left to cancel. Putting this here eliminates the possibility of us racing with EndBuild to access the nodeManager before - // EndBuild sets it to null. - if (_buildManagerState != BuildManagerState.Building) + // If the state is Idle - then there is yet or already nothing to cancel + // If state is WaitingForBuildToComplete - we might be already waiting gracefully - but CancelAllSubmissions + // is a request for quick abort - so it's fine to attempt again here + if (_buildManagerState == BuildManagerState.Idle) { return; } @@ -2094,17 +2089,17 @@ private void ShutdownConnectedNodes(bool abort) lock (_syncLock) { _shuttingDown = true; - _executionCancellationTokenSource.Cancel(); + _executionCancellationTokenSource?.Cancel(); // If we are aborting, we will NOT reuse the nodes because their state may be compromised by attempts to shut down while the build is in-progress. - _nodeManager.ShutdownConnectedNodes(!abort && _buildParameters.EnableNodeReuse); + _nodeManager?.ShutdownConnectedNodes(!abort && _buildParameters.EnableNodeReuse); // if we are aborting, the task host will hear about it in time through the task building infrastructure; // so only shut down the task host nodes if we're shutting down tidily (in which case, it is assumed that all // tasks are finished building and thus that there's no risk of a race between the two shutdown pathways). if (!abort) { - _taskHostNodeManager.ShutdownConnectedNodes(_buildParameters.EnableNodeReuse); + _taskHostNodeManager?.ShutdownConnectedNodes(_buildParameters.EnableNodeReuse); } } }