1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

mysqld: ignore SIGHUP sent by the kernel

SIGHUP causes debug info in the error log and reload of
logs/privileges/tables/etc. The server should only do it when
a user intentionally sends SUGHUP, not when a parent terminal gets
disconnected or something.

In particular, not ignoring kernel SIGHUP causes FLUSH PRIVILEGES
at some random point during non-systemd Debian upgrades (Debian
restarts mysqld, debian-start script runs mysql_upgrade in the background,
postinit script ends and kernel sends SIGHUP to all background processes
it has started). And during mysql_upgrade privilege tables aren't
necessarily ready to be reloaded.
This commit is contained in:
Sergei Golubchik
2018-12-07 13:05:34 +01:00
parent 97dbb3562b
commit 07e9b13898
6 changed files with 23 additions and 7 deletions

View File

@@ -189,7 +189,19 @@ extern int my_pthread_create_detached;
int sigwait(sigset_t *set, int *sig);
#endif
#define my_sigwait(A,B) sigwait((A),(B))
static inline int my_sigwait(sigset_t *set, int *sig, int *code)
{
#ifdef HAVE_SIGWAITINFO
siginfo_t siginfo;
*sig= sigwaitinfo(set, &siginfo);
*code= siginfo.si_code;
return *sig < 0 ? errno : 0;
#else
#define SI_KERNEL 128
*code= 0;
return sigwait(set, sig);
#endif
}
#if defined(HAVE_SIGTHREADMASK) && !defined(HAVE_PTHREAD_SIGMASK)
#define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C))