MDEV-5131 create_embedded_thd is not thread safe, libmysqld.
The emb_free_embedded_thd() has the thread-unsafe code so should be 'mutexed' also.
This commit is contained in:
parent
c7db46a242
commit
4e243be509
@ -416,11 +416,13 @@ int emb_unbuffered_fetch(MYSQL *mysql, char **row)
|
|||||||
static void emb_free_embedded_thd(MYSQL *mysql)
|
static void emb_free_embedded_thd(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
THD *thd= (THD*)mysql->thd;
|
THD *thd= (THD*)mysql->thd;
|
||||||
|
mysql_mutex_lock(&LOCK_thread_count);
|
||||||
thd->clear_data_list();
|
thd->clear_data_list();
|
||||||
thread_count--;
|
thread_count--;
|
||||||
thd->store_globals();
|
thd->store_globals();
|
||||||
thd->unlink();
|
thd->unlink();
|
||||||
delete thd;
|
delete thd;
|
||||||
|
mysql_mutex_unlock(&LOCK_thread_count);
|
||||||
my_pthread_setspecific_ptr(THR_THD, 0);
|
my_pthread_setspecific_ptr(THR_THD, 0);
|
||||||
mysql->thd=0;
|
mysql->thd=0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user