Skip to content
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

ConsoleHost shutdown timeout too short #61

Open
Tanhe opened this issue Dec 14, 2017 · 8 comments
Open

ConsoleHost shutdown timeout too short #61

Tanhe opened this issue Dec 14, 2017 · 8 comments

Comments

@Tanhe
Copy link
Contributor

Tanhe commented Dec 14, 2017

When running as a console application, shutdown is only given 150ms to complete. I have a very simple application and all I'm doing in shutdown is starting an async stop of an aspnet core application and it takes about 170ms to complete.

The ServiceHost gives a 1000ms timeout here in this case. I would recommend minimally making the timeouts match in the ConsoleHost. Ideally, all of these timeouts would be configurable. I believe the win32 service api allows an application to request additional startup/shutdown time if these timeouts were to be made significantly larger.

@PeterKottas
Copy link
Owner

Functionality added by https://github.com/PeterKottas/DotNetCore.WindowsService/releases/tag/v2.0.5. Timeout is now configurable. Thanks for raising this

@Tanhe
Copy link
Contributor Author

Tanhe commented Dec 21, 2017

Peter maybe I'm being dense, I don't see changes in 2.0.5 that address this issue.

@PeterKottas
Copy link
Owner

Maybe we're talking about different timeouts then. I've modified the one that waits for change in service state and made it configurable. Is it not the one you were talking about?

@Tanhe
Copy link
Contributor Author

Tanhe commented Jan 5, 2018

In ConsoleServiceHost.cs, the method HandleCancelKeyPress only waits 150ms for the application to terminate after sending the stop signal. I don't have a way to get my application to respond to the event that quickly when running locally. This timeout is much shorter than the same timeout in the real service host.

@PeterKottas
Copy link
Owner

Ah sure, the topshelf ripoff :) Ok I should be able to get that there over the weekend.

@PeterKottas
Copy link
Owner

@knoxi
Copy link

knoxi commented Aug 16, 2018

There is still a timeout of 150ms in ConsoleServiceHost / HandleCancelKeyPress at line 112.
I have also an issue with this short time to shutdown the application or debug in the shutdown.
Could all this timeouts be made configurable?

@PeterKottas
Copy link
Owner

PeterKottas commented Aug 16, 2018

Yeah definitely. Feel free to create a PR to do this. I might end up doing it myself but it will take a few weeks at least.

@PeterKottas PeterKottas reopened this Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants