Skip to content

Commit adf1131

Browse files
author
Oleksii Kononenko
committed
Merged PR 675990: Fix a crash caused by pip cancellation
Fix a crash caused by pip cancellation Related work items: #1968695, #1980181
1 parent 882efad commit adf1131

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

Public/Src/Engine/Scheduler/ExecutionResult.cs

-12
Original file line numberDiff line numberDiff line change
@@ -674,18 +674,6 @@ public static ExecutionResult GetFailureNotRunResult(LoggingContext loggingConte
674674
return result;
675675
}
676676

677-
/// <summary>
678-
/// Gets a cancelled result without run information.
679-
/// </summary>
680-
public static ExecutionResult GetCancelledNotRunResult(LoggingContext loggingContext)
681-
{
682-
var result = new ExecutionResult();
683-
result.SetResult(loggingContext, PipResultStatus.Canceled);
684-
result.Seal();
685-
686-
return result;
687-
}
688-
689677
/// <summary>
690678
/// Gets a failure result for testing purposes.
691679
/// </summary>

Public/Src/Engine/Scheduler/RunnablePip.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ public PipExecutionStep Cancel()
329329
// Make sure that ExecutionResult is always initialized.
330330
if ((PipType == PipType.Process || PipType == PipType.Ipc) && ExecutionResult == null)
331331
{
332-
SetExecutionResult(ExecutionResult.GetCancelledNotRunResult(LoggingContext));
332+
Contract.Assert(Environment.IsTerminating, "Attempted to cancel a pip prior its execution but the scheduler is not terminating.");
333+
SetExecutionResult(ExecutionResult.GetRetryableNotRunResult(LoggingContext, RetryInfo.GetDefault(RetryReason.StoppedWorker)));
333334
}
334335

335336
return PipExecutionStep.Cancel;

0 commit comments

Comments
 (0)