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

Handle SIGTERM on windows (close window event) #2481

Merged
merged 1 commit into from
Sep 1, 2021

Conversation

wallyqs
Copy link
Member

@wallyqs wallyqs commented Sep 1, 2021

Since Go 1.14, close window event on windows becomes SIGTERM which we are currently not handling so becomes a non graceful exit that could be more difficult to recover from sometimes. With this change, it now catches the terminated signal so exits gracefully:

[12616] 2021/09/01 16:31:50.537622 [INF] Server is ready
[12616] 2021/09/01 16:32:03.179669 [DBG] Trapped "terminated" signal
[12616] 2021/09/01 16:32:03.180442 [INF] Initiating Shutdown...
[12616] 2021/09/01 16:32:03.181038 [INF] Initiating JetStream Shutdown...
[12616] 2021/09/01 16:32:03.181038 [INF] JetStream Shutdown
[12616] 2021/09/01 16:32:03.182625 [DBG] Client accept loop exiting..
[12616] 2021/09/01 16:32:03.182969 [DBG] SYSTEM - System connection closed: Client Closed
[12616] 2021/09/01 16:32:03.182969 [INF] Server Exiting..

Related to #2397

/cc @nats-io/core

Copy link
Member

@ColinSullivan1 ColinSullivan1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wallyqs wallyqs merged commit 219a7c9 into main Sep 1, 2021
@wallyqs wallyqs deleted the windows-syscall-sigterm branch September 1, 2021 22:13
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

Successfully merging this pull request may close these issues.

None yet

3 participants