Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
10.2(EOL), 10.3(EOL), 10.4(EOL)
-
None
Description
In innodb_init() there's wait for thd_destructor_thread startup:
mysql_thread_create(thd_destructor_thread_key,
|
&thd_destructor_thread,
|
NULL, thd_destructor_proxy, NULL);
|
while (!my_atomic_loadptr_explicit(reinterpret_cast<void**>
|
(&srv_running),
|
MY_MEMORY_ORDER_RELAXED))
|
os_thread_sleep(20);
|
However if thd_destructor_thread dies before loadptr, this becomes dead loop. E.g. server shutdown during InnoDB initialisation?
Second problem is in innobase_end(). In fact time to time I get crashes here.
st_my_thread_var* running = reinterpret_cast<st_my_thread_var*>(
|
my_atomic_loadptr_explicit(
|
reinterpret_cast<void**>(&srv_running),
|
MY_MEMORY_ORDER_RELAXED));
|
if (!abort_loop && running) {
|
// may be UNINSTALL PLUGIN statement
|
running->abort = 1;
|
mysql_cond_broadcast(running->current_cond);
|
}
|
If thd_destructor_thread dies between atomic load and mysql_cond_broadcast(), it'll attempt to broadcast on destroyed cond via freed "running" pointer.
The problem is much broader though. Background threads creation/destruction synchronisation is in sorry state. So we need to implement some universally applicable framework.
Attachments
Issue Links
- relates to
-
MDEV-16264 Implement a common work queue for InnoDB background tasks
- Closed