Ignore SIGTERM during the vpp boot sequence 69/18469/2
authorDave Barach <dave@barachs.net>
Thu, 21 Mar 2019 22:01:48 +0000 (18:01 -0400)
committerFlorin Coras <florin.coras@gmail.com>
Thu, 21 Mar 2019 23:17:51 +0000 (23:17 +0000)
Call setjmp and mark the setjmp context valid just prior to entering the
vpp main loop.

Change-Id: I26d5cd6a624cb2a497d81eb85a62365621b3b469
Signed-off-by: Dave Barach <dave@barachs.net>
src/vlib/main.c
src/vlib/unix/main.c

index c80aa5a..ecadc19 100644 (file)
@@ -2083,6 +2083,17 @@ vlib_main (vlib_main_t * volatile vm, unformat_input_t * input)
   vec_validate (vm->processing_rpc_requests, 0);
   _vec_len (vm->processing_rpc_requests) = 0;
 
+  if ((error = vlib_call_all_config_functions (vm, input, 0 /* is_early */ )))
+    goto done;
+
+  /* Call all main loop enter functions. */
+  {
+    clib_error_t *sub_error;
+    sub_error = vlib_call_all_main_loop_enter_functions (vm);
+    if (sub_error)
+      clib_error_report (sub_error);
+  }
+
   switch (clib_setjmp (&vm->main_loop_exit, VLIB_MAIN_LOOP_EXIT_NONE))
     {
     case VLIB_MAIN_LOOP_EXIT_NONE:
@@ -2097,17 +2108,6 @@ vlib_main (vlib_main_t * volatile vm, unformat_input_t * input)
       goto done;
     }
 
-  if ((error = vlib_call_all_config_functions (vm, input, 0 /* is_early */ )))
-    goto done;
-
-  /* Call all main loop enter functions. */
-  {
-    clib_error_t *sub_error;
-    sub_error = vlib_call_all_main_loop_enter_functions (vm);
-    if (sub_error)
-      clib_error_report (sub_error);
-  }
-
   vlib_main_loop (vm);
 
 done:
index bf66407..fe1f94d 100755 (executable)
@@ -110,11 +110,16 @@ unix_signal_handler (int signum, siginfo_t * si, ucontext_t * uc)
     {
       /* these (caught) signals cause the application to exit */
     case SIGTERM:
-      if (unix_main.vlib_main->main_loop_exit_set)
+      /*
+       * Ignore SIGTERM if it's sent before we're ready.
+       */
+      if (unix_main.vlib_main && unix_main.vlib_main->main_loop_exit_set)
        {
          syslog (LOG_ERR | LOG_DAEMON, "received SIGTERM, exiting...");
          unix_main.vlib_main->main_loop_exit_now = 1;
        }
+      else
+       syslog (LOG_ERR | LOG_DAEMON, "IGNORE early SIGTERM...");
       break;
       /* fall through */
     case SIGQUIT: