From d2f2abe5252c5059dee5207e1b4614b24a8d4e96 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 10 Nov 2020 16:30:55 -0500 Subject: [PATCH] Add force-exit timeout to get around some of the exit hang issues users have observed. Will punt full diagnosis to V2 which rewrites all these code paths anyway. --- one.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/one.cpp b/one.cpp index c8a9dddf4..aba3bac2b 100644 --- a/one.cpp +++ b/one.cpp @@ -1480,8 +1480,13 @@ static int idtool(int argc,char **argv) static void _sighandlerHup(int sig) { } +static void _sighandlerReallyQuit(int sig) +{ + exit(0); +} static void _sighandlerQuit(int sig) { + alarm(5); // force exit after 5s OneService *s = zt1Service; if (s) s->terminate(); @@ -1873,7 +1878,7 @@ int main(int argc,char **argv) signal(SIGIO,SIG_IGN); signal(SIGUSR1,SIG_IGN); signal(SIGUSR2,SIG_IGN); - signal(SIGALRM,SIG_IGN); + signal(SIGALRM,&_sighandlerReallyQuit); signal(SIGINT,&_sighandlerQuit); signal(SIGTERM,&_sighandlerQuit); signal(SIGQUIT,&_sighandlerQuit);