mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Bug #38816: kill + flush tables with read lock + stored
procedures causes crashes! The problem of that bugreport was mostly fixed by the patch for bug 38691. However, attached test case focused on another crash or valgrind warning problem: SHOW PROCESSLIST query accesses freed memory of SP instruction that run in a parallel connection. Changes of thd->query/thd->query_length in dangerous places have been guarded with the per-thread LOCK_thd_data mutex (the THD::LOCK_delete mutex has been renamed to THD::LOCK_thd_data).
This commit is contained in:
@@ -1410,16 +1410,14 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
|
||||
thd_info->start_time= tmp->start_time;
|
||||
#endif
|
||||
thd_info->query=0;
|
||||
/* Lock THD mutex that protects its data when looking at it. */
|
||||
pthread_mutex_lock(&tmp->LOCK_thd_data);
|
||||
if (tmp->query)
|
||||
{
|
||||
/*
|
||||
query_length is always set to 0 when we set query = NULL; see
|
||||
the comment in sql_class.h why this prevents crashes in possible
|
||||
races with query_length
|
||||
*/
|
||||
uint length= min(max_query_length, tmp->query_length);
|
||||
thd_info->query=(char*) thd->strmake(tmp->query,length);
|
||||
}
|
||||
pthread_mutex_unlock(&tmp->LOCK_thd_data);
|
||||
thread_infos.append(thd_info);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user