Skip to content

Commit 5be9a9d

Browse files
committed
Merged PR 717018: Catch InvalidOperationException inside RemoteWorker
1 parent 96a3433 commit 5be9a9d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Public/Src/Engine/Dll/Distribution/RemoteWorker.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,18 @@ private void SendBuildRequests()
236236
m_pipCompletionTaskList.Add(firstItem.Item1);
237237
m_buildRequestList.Add(firstItem.Item2);
238238

239-
while (m_buildRequestList.Count < MaxMessagesPerBatch && m_buildRequests.TryTake(out var item, EngineEnvironmentSettings.RemoteWorkerSendBuildRequestTimeoutMs.Value ?? 0))
239+
try
240240
{
241-
m_pipCompletionTaskList.Add(item.Item1);
242-
m_buildRequestList.Add(item.Item2);
241+
while (m_buildRequestList.Count < MaxMessagesPerBatch && m_buildRequests.TryTake(out var item, EngineEnvironmentSettings.RemoteWorkerSendBuildRequestTimeoutMs.Value ?? 0))
242+
{
243+
m_pipCompletionTaskList.Add(item.Item1);
244+
m_buildRequestList.Add(item.Item2);
245+
}
246+
}
247+
catch (InvalidOperationException)
248+
{
249+
// We might have disconnected the worker. We should check the loop condition (buildRequests.IsCompleted) again.
250+
continue;
243251
}
244252

245253
m_currentBatchSize = m_pipCompletionTaskList.Count;

0 commit comments

Comments
 (0)