mirror of
https://git.freebsd.org/ports.git
synced 2025-06-06 05:10:29 -04:00
85 lines
3.2 KiB
Text
85 lines
3.2 KiB
Text
From 45279cb03d55859423349df7e11caa5ae2b012c5 Mon Sep 17 00:00:00 2001
|
|
From: Dave Gosselin <dave.gosselin@mariadb.com>
|
|
Date: Mon, 13 May 2024 10:36:11 -0400
|
|
Subject: [PATCH] MDEV-34129 mariadb-install-db appears to hang on macOS
|
|
|
|
A bug in signal_handler thread initialization led to an overcomplicated
|
|
implementation of wait_for_signal_handler_to_end, namely that we could
|
|
fail to initialize the signal handler but mark it as active anyway.
|
|
This meant that we could wait for it to terminate when it didn't exist
|
|
in the first place.
|
|
|
|
Additionally, let's immediately close down the signal handler loop when
|
|
we decide to break connections--it's the start of process termination
|
|
anyway, and there's no need to wait once we've invoked break_connections.
|
|
--- mysql-test/suite/rpl/r/rpl_shutdown_sighup.result.orig 2024-05-10 21:02:44 UTC
|
|
+++ mysql-test/suite/rpl/r/rpl_shutdown_sighup.result
|
|
@@ -41,7 +41,6 @@ connection slave;
|
|
shutdown;
|
|
connection server_2;
|
|
connection slave;
|
|
-include/assert_grep.inc [Ensure warning is issued that signal handler thread is still processing]
|
|
#
|
|
# Cleanup
|
|
connection master;
|
|
.../suite/rpl/r/rpl_shutdown_sighup.result | 1 -
|
|
.../suite/rpl/t/rpl_shutdown_sighup.test | 7 ---
|
|
sql/mysqld.cc | 61 ++++++++++---------
|
|
3 files changed, 32 insertions(+), 37 deletions(-)
|
|
|
|
--- mysql-test/suite/rpl/t/rpl_shutdown_sighup.test.orig 2024-05-10 21:02:44 UTC
|
|
+++ mysql-test/suite/rpl/t/rpl_shutdown_sighup.test
|
|
@@ -137,13 +137,6 @@ --source include/wait_until_connected_again.inc
|
|
--enable_reconnect
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
---let $assert_text= Ensure warning is issued that signal handler thread is still processing
|
|
---let $assert_select= Signal handler thread did not exit in a timely manner.
|
|
---let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
|
|
---let $assert_count= 1
|
|
---let $assert_only_after = CURRENT_TEST: rpl.rpl_shutdown_sighup
|
|
---source include/assert_grep.inc
|
|
-
|
|
|
|
--echo #
|
|
--echo # Cleanup
|
|
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
|
|
index 5ae30282729..68d8a04430f 100644
|
|
--- sql/mysqld.cc.orig
|
|
+++ sql/mysqld.cc
|
|
@@ -3205,6 +3205,15 @@ static void start_signal_handler(void)
|
|
DBUG_VOID_RETURN;
|
|
}
|
|
|
|
+/** Called only from signal_hand function. */
|
|
+static void* exit_signal_handler()
|
|
+{
|
|
+ my_thread_end();
|
|
+ signal_thread_in_use= 0;
|
|
+ pthread_exit(0); // Safety
|
|
+ return nullptr; // Avoid compiler warnings
|
|
+}
|
|
+
|
|
|
|
/** This threads handles all signals and alarms. */
|
|
/* ARGSUSED */
|
|
@@ -3265,10 +3274,7 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
|
|
if (abort_loop)
|
|
{
|
|
DBUG_PRINT("quit",("signal_handler: calling my_thread_end()"));
|
|
- my_thread_end();
|
|
- signal_thread_in_use= 0;
|
|
- pthread_exit(0); // Safety
|
|
- return 0; // Avoid compiler warnings
|
|
+ return exit_signal_handler();
|
|
}
|
|
switch (sig) {
|
|
case SIGTERM:
|
|
@@ -3287,6 +3293,7 @@ pthread_handler_t signal_hand(void *arg __attribute__((unused)))
|
|
PSI_CALL_delete_current_thread();
|
|
my_sigset(sig, SIG_IGN);
|
|
break_connect_loop(); // MIT THREAD has a alarm thread
|
|
+ return exit_signal_handler();
|
|
}
|
|
break;
|
|
case SIGHUP:
|