mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
Fix threadpool memory leak and connect2 test
This commit is contained in:
parent
f12229f63e
commit
351026ca53
5 changed files with 11 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
|||
call mtr.add_suppression("Allocation failed");
|
||||
SET @old_debug= @@session.debug;
|
||||
set @old_thread_cache_size=@@global.thread_cache_size;
|
||||
select 1;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
# This test makes no sense with the embedded server
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_debug.inc
|
||||
|
||||
call mtr.add_suppression("Allocation failed");
|
||||
SET @old_debug= @@session.debug;
|
||||
set @old_thread_cache_size=@@global.thread_cache_size;
|
||||
|
||||
|
|
|
|||
|
|
@ -122,13 +122,19 @@ THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
|
|||
pthread_setspecific(THR_KEY_mysys, 0);
|
||||
my_thread_init();
|
||||
st_my_thread_var* mysys_var= (st_my_thread_var *)pthread_getspecific(THR_KEY_mysys);
|
||||
DBUG_EXECUTE_IF("simulate_failed_connection_1", mysys_var= NULL; my_thread_end(););
|
||||
if (!mysys_var ||!(thd= connect->create_thd()))
|
||||
{
|
||||
/* Out of memory? */
|
||||
connect->close_and_delete();
|
||||
if (mysys_var)
|
||||
{
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
/*
|
||||
current PSI is still from worker thread.
|
||||
Set to 0, to avoid premature cleanup by my_thread_end
|
||||
*/
|
||||
if (PSI_server) PSI_server->set_thread(0);
|
||||
#endif
|
||||
my_thread_end();
|
||||
}
|
||||
worker_context.restore();
|
||||
|
|
|
|||
|
|
@ -1235,6 +1235,7 @@ void tp_add_connection(CONNECT *connect)
|
|||
connection= alloc_connection();
|
||||
if (!connection)
|
||||
{
|
||||
connect->close_and_delete();
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
connection->connect= connect;
|
||||
|
|
|
|||
|
|
@ -663,6 +663,7 @@ void tp_add_connection(CONNECT *connect)
|
|||
{
|
||||
connection_t *con;
|
||||
con= (connection_t *)malloc(sizeof(connection_t));
|
||||
DBUG_EXECUTE_IF("simulate_failed_connection_1", free(con);con= 0; );
|
||||
if (!con)
|
||||
{
|
||||
tp_log_warning("Allocation failed", "tp_add_connection");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue