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

Request: lifecycle hooks for before kill signal #4923

Open
gfodor opened this issue Apr 13, 2018 · 5 comments
Open

Request: lifecycle hooks for before kill signal #4923

gfodor opened this issue Apr 13, 2018 · 5 comments
Labels
Focus :Plan Build Focus:Supervisor ProcessManagement Related to how the Supervisor manages service processes Focus:Supervisor Related to the Habitat Supervisor (core/hab-sup) component Stale Type: Feature Issues that describe a new desired feature
Milestone

Comments

@gfodor
Copy link

gfodor commented Apr 13, 2018

We would like to be able to de-register our service from a load balancer when it is about to be restarted by Habitat, by running a hook before the termination signal is sent. The feature proposed in #2447 is somewhat overlapping since it could be used to solve the same problem, but that solution requires the application handle it, and often it's not possible to change the application or it is the wrong separation of concerns.

Specifically, some lifecycle events which would be useful are:

  • pre-config-restart - Run before the service is sent the kill signal when it is being restarted due to a config change or file upload (ie there is no reload hook)

  • pre-upgrade-restart - Run before the service is sent the kill signal when it is being restarted due to a package upgrade

  • pre-stop - Run before the service is sent the kill signal, when it is being shut down.

  • pre-kill - Run before the service is sent the kill signal, regardless of the reason.

@gfodor gfodor changed the title Request: lifecycle hook pre-upgrade/configure Request: lifecycle hooks for before kill signal Apr 13, 2018
@baumanj
Copy link
Contributor

baumanj commented Jul 2, 2018

Valid as of v0.57

@baumanj baumanj removed their assignment Jul 2, 2018
@baumanj baumanj added this to the Supervisor Usability milestone Jul 2, 2018
@christophermaier
Copy link
Contributor

@gfodor Could you provide some concrete usecase examples of your proposed hooks, along the lines of "Application W could use hook X because that would allow it to do Y, which is impossible/impractical/etc. currently because Z"? Just wanting to make sure that whatever we end up implementing serves the intended purpose.

Thanks!

@gfodor
Copy link
Author

gfodor commented Jul 4, 2018

Sure.

pre-upgrade-restart - For applications (like Erlang/Elixir applications) this is useful for preparing/performing hot code reloading, since it allows capturing a package upgrade event

pre-config-restart - Hard to think of a concrete example here, but this generally just makes sense because it's the inverse set of scenarios of the above one

pre-kill - The use case mentioned in the main ticket, this would allow the removal of the node from the load balancer and connection draining to happen before the service is killed.

pre-stop - Hard to think of a good example here, but you could imagine similar AWS-resource oriented changes that are only relevant when the service is being shut down for longer-term maintenance. For example, you could update AWS tags, drop a file for nginx to read to put up a maintenence page, etc.

@qubitrenegade
Copy link
Contributor

I think core/iptables would benefit from a pre-stop hook as it would allow iptables to save rules before shutting down.

@christophermaier christophermaier added the Focus:Supervisor ProcessManagement Related to how the Supervisor manages service processes label Nov 30, 2018
@davidMcneil davidMcneil self-assigned this Jun 7, 2019
@davidMcneil davidMcneil removed their assignment Aug 19, 2019
@christophermaier christophermaier added Focus:Supervisor Related to the Habitat Supervisor (core/hab-sup) component Type: Feature Issues that describe a new desired feature and removed A-supervisor labels Jul 24, 2020
@stale
Copy link

stale bot commented Aug 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.

@stale stale bot added the Stale label Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Focus :Plan Build Focus:Supervisor ProcessManagement Related to how the Supervisor manages service processes Focus:Supervisor Related to the Habitat Supervisor (core/hab-sup) component Stale Type: Feature Issues that describe a new desired feature
Projects
None yet
Development

No branches or pull requests

7 participants