mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
add a simplest SIGCHLD handler in order to avoid zombies in the docker container governed by the script
This commit is contained in:
@@ -19,6 +19,14 @@ def sigterm_handler(signo, stack_frame):
|
||||
sys.exit()
|
||||
|
||||
|
||||
# handle SIGCHILD, since we are the equivalent of the INIT process
|
||||
def sigchld_handler(signo, stack_frame):
|
||||
try:
|
||||
os.waitpid(-1, os.WNOHANG)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
class Governor:
|
||||
|
||||
INSTANCE_METADATA_URL = "http://169.254.169.254/latest/meta-data/"
|
||||
@@ -96,4 +104,5 @@ def main():
|
||||
if __name__ == '__main__':
|
||||
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', level=logging.INFO)
|
||||
signal.signal(signal.SIGTERM, sigterm_handler)
|
||||
signal.signal(signal.SIGCHLD, sigchld_handler)
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user