Skip to content

Commit f3fd244

Browse files
committed
BUG#26042764: BACKPORT BUG#25642343 AND BUG#24311527 TO 5.7
BUG#24311527: PLUGIN-LOAD FAILS AFTER MYSQLD --INITIALIZE BUG#25642343: THE SERVER SHOULD HAVE A DEFAULT USER FOR THE SERVER SESION SERVICE There were two leaks after the above patch was introduced: 1) There was a possible memory leak on method Session_plugin_thread::terminate_session_thread(), on which the terminate event could be queued after the thread handler being already terminated. This would cause the terminate event memory not to be released. In order to prevent that, the Session_plugin_thread::terminate_session_thread ensures that when it ends all queued events are released. 2) When the Group Replication was not able to contact the server core through the SQL API, some memory structures were not being released. Now that memory structures are properly released.
1 parent ac4b621 commit f3fd244

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

rapid/plugin/group_replication/src/delayed_plugin_initialization.cc

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,18 @@ int Delayed_initialization_thread::initialization_thread_handler()
148148
DBUG_ASSERT(server_engine_initialized());
149149
wait_on_engine_initialization= false;
150150

151+
//Avoid unnecessary operations
152+
bool enabled_super_read_only= false;
153+
154+
char *hostname, *uuid;
155+
uint port;
156+
unsigned int server_version;
157+
st_server_ssl_variables server_ssl_variables=
158+
{false,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
159+
160+
get_server_parameters(&hostname, &port, &uuid, &server_version,
161+
&server_ssl_variables);
162+
151163
sql_command_interface= new Sql_service_command_interface();
152164
if (sql_command_interface->
153165
establish_session_connection(PSESSION_INIT_THREAD,
@@ -158,22 +170,11 @@ int Delayed_initialization_thread::initialization_thread_handler()
158170
log_message(MY_ERROR_LEVEL,
159171
"It was not possible to establish a connection to "
160172
"server SQL service");
161-
goto end;
173+
error= 1;
174+
goto err;
162175
/* purecov: end */
163176
}
164177

165-
//Avoid unnecessary operations
166-
bool enabled_super_read_only= false;
167-
168-
char *hostname, *uuid;
169-
uint port;
170-
unsigned int server_version;
171-
st_server_ssl_variables server_ssl_variables=
172-
{false,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
173-
174-
get_server_parameters(&hostname, &port, &uuid, &server_version,
175-
&server_ssl_variables);
176-
177178
if ((error= configure_group_communication(&server_ssl_variables)))
178179
goto err; /* purecov: inspected */
179180

rapid/plugin/group_replication/src/sql_service/sql_service_command.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,13 @@ Session_plugin_thread::terminate_session_thread()
640640

641641
DBUG_ASSERT(!m_session_thread_running);
642642

643+
while (!this->incoming_methods->empty())
644+
{
645+
st_session_method *method= NULL;
646+
this->incoming_methods->pop(&method);
647+
my_free(method);
648+
}
649+
643650
mysql_mutex_unlock(&m_run_lock);
644651

645652
DBUG_RETURN(0);

0 commit comments

Comments
 (0)