From 22eb7d621b155108d03dc6206e8546ba8b50b5fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Tue, 13 Sep 2022 13:28:44 +0000 Subject: [PATCH] Prevent a crash during shutdown if Cluster is running If ProxySQL Cluster is running and the proxysql instance is shutting down in a graceful way, Cluster was trying to access already freed resources causing a crash. --- lib/ProxySQL_Admin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ProxySQL_Admin.cpp b/lib/ProxySQL_Admin.cpp index ba785017c3..6bf6194f6e 100644 --- a/lib/ProxySQL_Admin.cpp +++ b/lib/ProxySQL_Admin.cpp @@ -5234,7 +5234,7 @@ void admin_session_handler(MySQL_Session *sess, void *_pa, PtrSize_t *pkt) { } __run_query: - if (sess->proxysql_node_address) { + if (sess->proxysql_node_address && (__sync_fetch_and_add(&glovars.shutdown,0)==0)) { if (sess->client_myds->active) { const string uuid { sess->proxysql_node_address->uuid }; const string hostname { sess->proxysql_node_address->hostname };