Skip to content

Commit

Permalink
Merged PR 675990: Fix a crash caused by pip cancellation
Browse files Browse the repository at this point in the history
Fix a crash caused by pip cancellation

Related work items: #1968695, #1980181
  • Loading branch information
Oleksii Kononenko committed Aug 22, 2022
1 parent 80769b2 commit 150ccab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
12 changes: 0 additions & 12 deletions Public/Src/Engine/Scheduler/ExecutionResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -674,18 +674,6 @@ public static ExecutionResult GetFailureNotRunResult(LoggingContext loggingConte
return result;
}

/// <summary>
/// Gets a cancelled result without run information.
/// </summary>
public static ExecutionResult GetCancelledNotRunResult(LoggingContext loggingContext)
{
var result = new ExecutionResult();
result.SetResult(loggingContext, PipResultStatus.Canceled);
result.Seal();

return result;
}

/// <summary>
/// Gets a failure result for testing purposes.
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion Public/Src/Engine/Scheduler/RunnablePip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ public PipExecutionStep Cancel()
// Make sure that ExecutionResult is always initialized.
if ((PipType == PipType.Process || PipType == PipType.Ipc) && ExecutionResult == null)
{
SetExecutionResult(ExecutionResult.GetCancelledNotRunResult(LoggingContext));
Contract.Assert(Environment.IsTerminating, "Attempted to cancel a pip prior its execution but the scheduler is not terminating.");
SetExecutionResult(ExecutionResult.GetRetryableNotRunResult(LoggingContext, RetryInfo.GetDefault(RetryReason.StoppedWorker)));
}

return PipExecutionStep.Cancel;
Expand Down

0 comments on commit 150ccab

Please sign in to comment.