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

chore: improve signal handling code #344

Merged
merged 1 commit into from
Nov 24, 2024
Merged

chore: improve signal handling code #344

merged 1 commit into from
Nov 24, 2024

Conversation

romange
Copy link
Owner

@romange romange commented Nov 23, 2024

  1. Relax ClearSignal function - now it can be called on unregistered signals (before it check-failed)
  2. Now it is possible to install the ignore handler,
    which is what we really want to use when we clear the signal handlers via AcceptServer.
    Indeed, if accept server is shut down, the process will usually exit right after.
    There will be some clean up code but that's it. So we do not want to interrupt due sigterm/sigint signals because
    we are already in the process of shutting down anyway. Before this change - if we got the signal during the
    critical section after the accept server handlers were cleared, and default handlers were installed,
    the process would exit with -15 for SIGTERM and -2 for SIGINT just because it would catch these signals
    during the shutdown.

1. Relax ClearSignal function - now it can be called on unregistered signals (before it check-failed)
2. Now it is possible to install the ignore handler,
   which is what we really want to use when we clear the signal handlers via AcceptServer.
   Indeed, if accept server is shut down, the process will usually exit right after.
   There will be some clean up code but that's it. So we do not want to interrupt due sigterm/sigint signals because
   we are already in the process of shutting down anyway. Before this change - if we got the signal during the
   critical section after the accept server handlers were cleared, and default handlers were installed,
   the process would exit with -15 for SIGTERM and -2 for SIGINT just because it would catch these signals
   during the shutdown.

Signed-off-by: Roman Gershman <[email protected]>
@romange romange changed the title chore: relax code in RegisterSignal chore: improve signal handling code Nov 23, 2024
util/fibers/accept_server.cc Show resolved Hide resolved
@romange romange merged commit ff9b6cd into master Nov 24, 2024
5 checks passed
@romange romange deleted the Pr4 branch November 24, 2024 06:03
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.

2 participants