From 11fa009c888e631e54c628f02ff5deba9b7bb292 Mon Sep 17 00:00:00 2001 From: Forgind Date: Fri, 29 Oct 2021 15:55:29 -0700 Subject: [PATCH] Attempt to prevent node explosions --- .../BackEnd/Components/Communications/NodeProviderOutOfProc.cs | 2 +- .../Components/Communications/NodeProviderOutOfProcTaskHost.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProc.cs b/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProc.cs index 11ea72ba505..3472c8ff01d 100644 --- a/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProc.cs +++ b/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProc.cs @@ -76,7 +76,7 @@ public bool CreateNode(int nodeId, INodePacketFactory factory, NodeConfiguration { ErrorUtilities.VerifyThrowArgumentNull(factory, nameof(factory)); - if (_nodeContexts.Count == ComponentHost.BuildParameters.MaxNodeCount) + if (_nodeContexts.Count >= ComponentHost.BuildParameters.MaxNodeCount) { ErrorUtilities.ThrowInternalError("All allowable nodes already created ({0}).", _nodeContexts.Count); return false; diff --git a/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs b/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs index 2a917d6eaee..136348b442c 100644 --- a/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs +++ b/src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs @@ -498,7 +498,7 @@ internal bool CreateNode(HandshakeOptions hostContext, INodePacketFactory factor ErrorUtilities.VerifyThrowArgumentNull(factory, nameof(factory)); ErrorUtilities.VerifyThrow(!_nodeIdToPacketFactory.ContainsKey((int)hostContext), "We should not already have a factory for this context! Did we forget to call DisconnectFromHost somewhere?"); - if (AvailableNodes == 0) + if (AvailableNodes <= 0) { ErrorUtilities.ThrowInternalError("All allowable nodes already created ({0}).", _nodeContexts.Count); return false;