From 6e5678315d6c7fa145053f66fe3ec01f4aaf69f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Tue, 13 Sep 2022 10:26:17 +0200 Subject: [PATCH 1/2] Fix crashes when number of servers is more than half the value of monitor 'ping|read_only' intervals --- lib/MySQL_Monitor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/MySQL_Monitor.cpp b/lib/MySQL_Monitor.cpp index 3a062f2da4..a826bc8eca 100644 --- a/lib/MySQL_Monitor.cpp +++ b/lib/MySQL_Monitor.cpp @@ -2655,6 +2655,7 @@ void * MySQL_Monitor::monitor_ping() { int us=100; if (resultset->rows_count) { us=mysql_thread___monitor_ping_interval/2/resultset->rows_count; + us = us == 0 ? 1 : us; us*=40; if (us > 1000000) { us = 10000; @@ -2926,6 +2927,7 @@ void * MySQL_Monitor::monitor_read_only() { int us=100; if (resultset->rows_count) { us=mysql_thread___monitor_read_only_interval/2/resultset->rows_count; + us = us == 0 ? 1 : us; us*=40; if (us > 1000000) { us = 10000; From ac738c27f88adeccab69da16c0e7721da3339d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Tue, 13 Sep 2022 10:34:52 +0200 Subject: [PATCH 2/2] Add crash signal handler for fatal arithmetic errors 'SIGFPE' --- lib/ProxySQL_GloVars.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ProxySQL_GloVars.cpp b/lib/ProxySQL_GloVars.cpp index 328cfba16c..741f751dde 100644 --- a/lib/ProxySQL_GloVars.cpp +++ b/lib/ProxySQL_GloVars.cpp @@ -169,6 +169,7 @@ void ProxySQL_GlobalVariables::install_signal_handler() { signal(SIGTERM, term_handler); signal(SIGSEGV, crash_handler); signal(SIGABRT, crash_handler); + signal(SIGFPE, crash_handler); signal(SIGPIPE, SIG_IGN); }