Skip to content

Commit ca63b44

Browse files
committed
Bug#35779802 - empty vio->signal_mask in the x plugin causes MySQL cannot handle signal
Description =========== VIO on POSIX systems uses PPOLL to do the IO. The VIO has a configuration option that allows overwrting the signal mask while doing the IO call. When sending SIGTERM (graceful shutdown) to the MySQL Server, the signal is handled by default signal handler (not by mysqld-signal handler). This leads to application forced shutdown (kill). Fix === Initialize VIO structure with correct signal mask, that is used with ppoll. Change-Id: I5f7de6d928af282f9217414a92ea1e268fb5e69c
1 parent 3f74e71 commit ca63b44

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

plugin/x/src/mysql_variables.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ const CHARSET_INFO *get_default_charset() {
4141
return &my_charset_utf8mb4_0900_ai_ci;
4242
}
4343

44+
sigset_t get_mysqld_signal_mask() { return mysqld_signal_mask; }
45+
4446
} // namespace mysqld

plugin/x/src/mysql_variables.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#ifndef PLUGIN_X_SRC_MYSQL_VARIABLES_H_
2626
#define PLUGIN_X_SRC_MYSQL_VARIABLES_H_
2727

28+
#include <signal.h>
29+
#include "my_inttypes.h" // NOLINT(build/include_subdir)
30+
2831
struct CHARSET_INFO;
2932

3033
namespace mysqld {
@@ -35,6 +38,7 @@ bool is_terminating();
3538
bool get_initialize();
3639
const char *get_my_localhost();
3740
const CHARSET_INFO *get_default_charset();
41+
sigset_t get_mysqld_signal_mask();
3842

3943
} // namespace mysqld
4044

plugin/x/src/ngs/socket_events.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "violite.h" // NOLINT(build/include_subdir)
3232

3333
#include "plugin/x/src/interface/connection_acceptor.h"
34+
#include "plugin/x/src/mysql_variables.h"
3435
#include "plugin/x/src/ngs/memory.h"
3536
#include "plugin/x/src/ngs/socket_events.h"
3637
#include "plugin/x/src/operations_factory.h"
@@ -93,6 +94,10 @@ class Connection_acceptor_socket : public xpl::iface::Connection_acceptor {
9394
is_tcpip ? VIO_TYPE_TCPIP : VIO_TYPE_SOCKET, 0);
9495
if (!vio) throw std::bad_alloc();
9596

97+
#ifdef USE_PPOLL_IN_VIO
98+
vio->signal_mask = mysqld::get_mysqld_signal_mask();
99+
#endif
100+
96101
// enable TCP_NODELAY
97102
vio_fastsend(vio);
98103
vio_keepalive(vio, true);

0 commit comments

Comments
 (0)