git: 9f97021574ac - main - databases/mariadb106-server: Fix hang on restart

From: Bernard Spil <brnrd_at_FreeBSD.org>
Date: Sun, 16 Jun 2024 17:14:40 UTC
The branch main has been updated by brnrd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9f97021574ac4b7d1ee5641fd58c5e4fa551a9bc

commit 9f97021574ac4b7d1ee5641fd58c5e4fa551a9bc
Author:     Bernard Spil <brnrd@FreeBSD.org>
AuthorDate: 2024-06-16 17:11:31 +0000
Commit:     Bernard Spil <brnrd@FreeBSD.org>
CommitDate: 2024-06-16 17:11:31 +0000

    databases/mariadb106-server: Fix hang on restart
    
    PR:             279362
    Obtained from:  https://jira.mariadb.org/browse/MDEV-34254
---
 databases/mariadb106-server/Makefile               |  2 +-
 databases/mariadb106-server/files/patch-MDEV-34254 | 52 ++++++++++++++++++++++
 2 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/databases/mariadb106-server/Makefile b/databases/mariadb106-server/Makefile
index 9195f49ada30..1523df03e7f1 100644
--- a/databases/mariadb106-server/Makefile
+++ b/databases/mariadb106-server/Makefile
@@ -1,6 +1,6 @@
 PORTNAME?=	mariadb
 PORTVERSION=	10.6.18
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES=	databases
 MASTER_SITES=	https://mirror.nodesdirect.com/${SITESDIR}/ \
 		https://mirror.one.com/${SITESDIR}/ \
diff --git a/databases/mariadb106-server/files/patch-MDEV-34254 b/databases/mariadb106-server/files/patch-MDEV-34254
new file mode 100644
index 000000000000..68210424694c
--- /dev/null
+++ b/databases/mariadb106-server/files/patch-MDEV-34254
@@ -0,0 +1,52 @@
+From 90d376e01710fbc6f7e9eeef3f8c4653d5d4d82e 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
+
+Immediately close down the signal handler loop when we decide to
+break connections as it's the start of process termination
+anyway, and there's no need to wait once we've invoked break_connections.
+---
+ sql/mysqld.cc | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/sql/mysqld.cc b/sql/mysqld.cc
+index cfc16209251c2..a9960400c17cd 100644
+--- sql/mysqld.cc.orig
++++ sql/mysqld.cc
+@@ -2953,6 +2953,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 */
+@@ -3013,10 +3022,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:
+@@ -3035,6 +3041,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: