mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
close callbacks prior to closing connection to avoid potential race when e.g timer callback and connection_destroy run in parallel
This commit is contained in:
@ -404,11 +404,6 @@ void set_wait_timeout(connection_t *connection, ulonglong old_timeout)
|
|||||||
/* Connection destructor */
|
/* Connection destructor */
|
||||||
void destroy_connection(connection_t *connection)
|
void destroy_connection(connection_t *connection)
|
||||||
{
|
{
|
||||||
if (connection->thd)
|
|
||||||
{
|
|
||||||
threadpool_remove_connection(connection->thd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (connection->io)
|
if (connection->io)
|
||||||
{
|
{
|
||||||
WaitForThreadpoolIoCallbacks(connection->io, TRUE);
|
WaitForThreadpoolIoCallbacks(connection->io, TRUE);
|
||||||
@ -427,6 +422,11 @@ void destroy_connection(connection_t *connection)
|
|||||||
WaitForThreadpoolTimerCallbacks(connection->timer, TRUE);
|
WaitForThreadpoolTimerCallbacks(connection->timer, TRUE);
|
||||||
CloseThreadpoolTimer(connection->timer);
|
CloseThreadpoolTimer(connection->timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (connection->thd)
|
||||||
|
{
|
||||||
|
threadpool_remove_connection(connection->thd);
|
||||||
|
}
|
||||||
|
|
||||||
DestroyThreadpoolEnvironment(&connection->callback_environ);
|
DestroyThreadpoolEnvironment(&connection->callback_environ);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user