You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.
PID File generated in daemon mode is supposed to be deleted via the context.Release() call. As of right now, any form of interrupt ( SIGTERM / SIGINT ) doesn't seem to change it's behaviour.
Also go-daemon seems to be pretty old, could that be the issue?
The text was updated successfully, but these errors were encountered:
imo the reason that the PID files don't get deleted is that in the code, context.Release() is defered, and defer isn't run if signals like SIGTERM and SIGINT are sent to the process because the process itself is basically stopped. You can try running this snippet and sending different signals to it.
This behaviour can be changed by adding some form of signal handling, like here. This works pretty well.
imo the reason that the PID files don't get deleted is that in the code, context.Release() is defered, and defer isn't run if signals like SIGTERM and SIGINT are sent to the process because the process itself is basically stopped. You can try running this snippet and sending different signals to it.
Ah that explains it. The example helped me see it in action, the defer statement isn't run on any of SIGINT, SIGHUP or SIGTERM. Thanks for that!
This behaviour can be changed by adding some form of signal handling, like here. This works pretty well.
We had explored this before, but we weren't sure of how to pass the flags from cobra/viper. go-daemon seems to use the flag package along with their own interface for specific flags. Do you know of a way to convert viper flags to the flags required by go-daemon?
My initial idea was to pass a pointer to daemon.BoolFlag using the value from viper, but that seems like a hack.
PID File generated in daemon mode is supposed to be deleted via the
context.Release()
call. As of right now, any form of interrupt ( SIGTERM / SIGINT ) doesn't seem to change it's behaviour.Also go-daemon seems to be pretty old, could that be the issue?
The text was updated successfully, but these errors were encountered: