From ae80f153159ca587f8ddc0bb9d8003265ab87635 Mon Sep 17 00:00:00 2001 From: Yubao Liu Date: Fri, 17 May 2019 11:41:21 +0800 Subject: [PATCH] fix crash on "proxysql restart" MySQL_HostGroups_Manager::get_MyConn_from_pool() inserts connection to mysrvc->ConnectionUsed, and this connections is also inserted to My_Thread->cached_connections which leads to double deallocation. Fixed https://github.com/sysown/proxysql/issues/1985. --- lib/MySQL_Thread.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index d4687712b..38c37c3d8 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -2714,10 +2714,7 @@ MySQL_Thread::~MySQL_Thread() { #endif // IDLE_THREADS if (cached_connections) { - while(cached_connections->len) { - MySQL_Connection *c=(MySQL_Connection *)cached_connections->remove_index_fast(0); - delete c; - } + return_local_connections(); delete cached_connections; }