don't wait indefinitely for signal handler in --bootstrap

FreeBSD doesn't like it and hangs.

As we don't wait for signal handler, let's disable SIGHUP in bootstrap
too
This commit is contained in:
Sergei Golubchik 2024-05-08 18:29:45 +02:00
parent 360a7ff760
commit 938b929372

View file

@ -2104,11 +2104,10 @@ static void wait_for_signal_thread_to_end()
if (err && err != ESRCH) if (err && err != ESRCH)
{ {
sql_print_error("Failed to send kill signal to signal handler thread, " sql_print_error("Failed to send kill signal to signal handler thread, "
"pthread_kill() errno: %d", "pthread_kill() errno: %d", err);
err);
} }
if (i == n_waits && signal_thread_in_use) if (i == n_waits && signal_thread_in_use && !opt_bootstrap)
{ {
sql_print_warning("Signal handler thread did not exit in a timely manner. " sql_print_warning("Signal handler thread did not exit in a timely manner. "
"Continuing to wait for it to stop.."); "Continuing to wait for it to stop..");
@ -2895,10 +2894,8 @@ void init_signals(void)
(void) sigemptyset(&set); (void) sigemptyset(&set);
my_sigset(SIGPIPE,SIG_IGN); my_sigset(SIGPIPE,SIG_IGN);
sigaddset(&set,SIGPIPE); sigaddset(&set,SIGPIPE);
#ifndef IGNORE_SIGHUP_SIGQUIT
sigaddset(&set,SIGQUIT); sigaddset(&set,SIGQUIT);
sigaddset(&set,SIGHUP); sigaddset(&set,SIGHUP);
#endif
sigaddset(&set,SIGTERM); sigaddset(&set,SIGTERM);
/* Fix signals if blocked by parents (can happen on Mac OS X) */ /* Fix signals if blocked by parents (can happen on Mac OS X) */
@ -2980,20 +2977,20 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
(void) sigaddset(&set,SIGINT); (void) sigaddset(&set,SIGINT);
(void) pthread_sigmask(SIG_UNBLOCK,&set,NULL); (void) pthread_sigmask(SIG_UNBLOCK,&set,NULL);
} }
(void) sigemptyset(&set); // Setup up SIGINT for debug (void) sigemptyset(&set);
#ifdef USE_ONE_SIGNAL_HAND #ifdef USE_ONE_SIGNAL_HAND
(void) sigaddset(&set,THR_SERVER_ALARM); // For alarms (void) sigaddset(&set,THR_SERVER_ALARM); // For alarms
#endif #endif
#ifndef IGNORE_SIGHUP_SIGQUIT
(void) sigaddset(&set,SIGQUIT); (void) sigaddset(&set,SIGQUIT);
(void) sigaddset(&set,SIGHUP);
#endif
(void) sigaddset(&set,SIGTERM); (void) sigaddset(&set,SIGTERM);
(void) sigaddset(&set,SIGTSTP); (void) sigaddset(&set,SIGTSTP);
/* Save pid to this process (or thread on Linux) */ /* Save pid to this process (or thread on Linux) */
if (!opt_bootstrap) if (!opt_bootstrap)
{
(void) sigaddset(&set,SIGHUP);
create_pid_file(); create_pid_file();
}
/* /*
signal to start_signal_handler that we are ready signal to start_signal_handler that we are ready