Fixed idle session processing

The current implementation of idle connection timeouts is not safe. The sessions
are handled in a way which is not thread-safe and the checking is done from
a non-polling thread.

With this change, the checks for the session timeouts are done in one of the
polling threads in a thread-safe manner only if at least one service has enabled
the timing out of idle client connections.
This commit is contained in:
Markus Makela
2016-01-05 06:31:07 +02:00
parent cdeb921b1b
commit c2310327fc
7 changed files with 77 additions and 36 deletions

View File

@ -35,6 +35,7 @@
#include <maxconfig.h>
#include <mysql.h>
#include <resultset.h>
#include <session.h>
#define PROFILE_POLL 0
@ -705,6 +706,11 @@ poll_waitevents(void *arg)
timeout_bias = 1;
}
if (check_timeouts && hkheartbeat >= next_timeout_check)
{
process_idle_sessions();
}
if (thread_data)
{
thread_data[thread_id].state = THREAD_ZPROCESSING;