-
Notifications
You must be signed in to change notification settings - Fork 599
Fix hosting exception during startup when CTRL+C #8886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
It would be good to get a test case that covers triggering the cancellation token to simulate CTRL-C to make sure that the host does in fact shut down cleanly. |
@dotnet-policy-service agree |
Not fully sure I wrote the test correctly but it seems to do simulate CTRL+C. |
@@ -130,6 +130,10 @@ public async Task RunApplicationAsync(CancellationToken cancellationToken = defa | |||
|
|||
await CreateContainersAndExecutablesAsync(cancellationToken).ConfigureAwait(false); | |||
} | |||
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested) | |||
{ | |||
// This is here so hosting does not throw an exception when CTRL+C during startup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would also be good to log a message here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume LogDebug
should be used based on other log calls in the same file, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please
Description
Added
catch (OperationCanceledException)
inDcpExecutor.cs
file to fixSystem.OperationCanceledException: The operation was canceled.
that happens during startup when container runtimedocker
is unhealthy and user pressed CTRL+C.Fixes #8838
Checklist
<remarks />
and<code />
elements on your triple slash comments?doc-idea
templatebreaking-change
templatediagnostic
template