-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix FastKillOnCancelKeyPress not stopping the process. #3935
Conversation
Issue #3933 |
…est" exception is emitted. Adding a validator to give a better error.
@@ -16,6 +17,9 @@ public void ConfigureServices(object configuration, IServiceCollection services) | |||
options.MaxStorageBusyRetries = reader.GetPropertyValue<int>("MaxStorageBusyRetries"); | |||
options.ConnectionString = reader.GetPropertyValue<string>("DataConnectionString"); | |||
}); | |||
|
|||
services.AddTransient<IConfigurationValidator>(sp => new AzureTableMembershipConfigurationValidator(configuration)); |
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.
This and the above IConfigurationValidator change seem orthogonal to this PR - maybe they should be moved into a separate PR
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.
Sorry I am new to this. I thought checking this into my fork would not affect this pull request. This issue is something else. When ClusterId is not set you get a Azure Storage Error "Bad Request". I was had to figure out what was wrong. This check-in was meant for my branch.
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.
No need to apologize :)
You can revert those changes in this branch and they'll disappear from here.
If you'd like assistance, let me know.
src/Orleans.Runtime/Silo/Silo.cs
Outdated
|
||
// force a non-graceful stop | ||
cancellationSource.Cancel(); | ||
this.siloLifecycle.OnStop(cancellationSource.Token); // don't wait for it to stop |
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.
Why this OnStop
call here when OnStop
will be called via StopAsync
below?
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.
Because the OnStop after call will get into the mode that just waits for State to Terminate, but nothing signals the lifecycle to stop.
It seems to me that the correct fix here is to not set EDIT: to clarify, what's happening today is that when someone hits Ctrl+C, the handler sets the |
I'm having the same issue you described @ReubenBond |
The way I worked around the issue in my console app is to turn FastKillOnCancelKeyPress=false and handle the cancel myself. Console.CancelKeyPress += Console_CancelKeyPress;
Update: Still not working for me in Kubernetes with this override. Probably due to this line in Orleans. |
@Jms69 that's how I think it should be done. We should remove the option and allow end-users to configure it themselves. Particularly since |
…Bad Request" exception is emitted. Adding a validator to give a better error." This reverts commit 4e90eee.
@Jms69 I submitted a PR against your fork: jsukhabut#1 If it works for you then you can merge it and this PR will automatically update |
Terminate gracefully on console cancel key
I merged the pull request and do some more testing. I am trying to get scale down to work in AKS Kubernetes cluster. As you mentioned earlier it would be cool if we can provide our own cancel action in case we wanted to do some extra shutdown code: builder.ConfigurationCancelAction(Action< ISiloHost > action); |
Scale up/down in Kubernetes now works perfectly. |
That's the idea behind the Generic Host Builder which will be released alongside .NET Core 2.1. Once that's available we will work to strip away this functionality and rely on that. |
I'm hoping we can have one more set of eyes on this. I'm happy with it. Please merge if you're happy with it. |
Thank you, @Jms69! |
From what I understand, here you are doing a clean shutdown, not a fast kill like before (and as the name in the config suggest). I think by default, we should not attempt to do a clean shutdown. Or at the very least, rename the current config flag |
Good point, the config flag name implies abrupt termination - which I would imagine looks like Longer term, Ctrl+C should at least attempt a clean shutdown the first time it's pressed, but this is a concern which we should shift to the generic host. |
When FastKillOnCancelKeyPress=true State is set to Closing but Stop process never starts.