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

Clean up signal handling and sentinel file #1188

Merged
merged 2 commits into from
May 23, 2018
Merged

Conversation

hglkrijger
Copy link
Member

  • in a child process, when handling a SIGTERM from the default handler we should call shutdown()
  • we should not emit a sentinel on normal startup because SIGKILL cannot be caught, and we consider this to be a clean shutdown; instead only emit a sentinel on an unhandled error
  • fix naming of sentinel everywhere
  • update tests

@@ -382,7 +378,6 @@ def _emit_restart_event(self):
except Exception:
pass

self._set_sentinal(msg="Starting")
Copy link
Member Author

Choose a reason for hiding this comment

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

Removing this is the primary fix here.

Copy link
Member

@jasonzio jasonzio left a comment

Choose a reason for hiding this comment

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

How often is SIGKILL a problem? I strongly suspect some other signal is clobbering the agent (SIGSEGV and the like) rather than the uncatchable SIGKILL. Will this change mean you no longer detect when the agent dies due to some other signal?

# A SIGKILL handler is not being registered at this time to
# minimize perturbing the code.
if signum in (signal.SIGTERM, signal.SIGKILL):
if signum == signal.SIGTERM:
Copy link
Member

Choose a reason for hiding this comment

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

Dh you want to catch SIGQUIT as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought SIGQUIT was a keyboard signal?

@hglkrijger
Copy link
Member Author

All we really do in the signal handler is clean up the sentinel and child processes, but we also do a cleanup on restart. So I think the value is purely in knowing 'something other than SIGTERM killed me', which is not actionable or imo very useful. I am going to merge, but happy to discuss further.

@hglkrijger hglkrijger merged commit 2251bc0 into Azure:master May 23, 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

Successfully merging this pull request may close these issues.

2 participants