1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00
Files
mariadb/mysql-test/main/rli_run_lock.result
ParadoxV5 728a4e7b5d MDEV-40298 Use-After-Free when SQL Thread stops in the middle of SHOW SLAVE STATUS
MDEV-36287 acknowledged that SHOW SLAVE STATUS needed to acquire a mutex
lock before accessing the SQL Thread’s THD, as otherwise it may access
invalid memory if a concurrent STOP SLAVE deletes the THD.
But it missed that the SQL Thread’s mutex is `mi->rli.run_lock`,
not `mi->run_lock`, so the bug was still not fixed.

This commit fills in the oversight by acquiring the correct
corresponding lock for each of `Slave_IO_State` & `Slave_SQL_State`.

Reviewed-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2026-07-22 13:48:15 -06:00

19 lines
665 B
Plaintext

CHANGE MASTER TO master_host='127.0.0.1', master_user='root';
START SLAVE SQL_THREAD;
include/wait_for_slave_sql_to_start.inc
SET @@SESSION.debug_sync=
'hold_sss_with_run_lock SIGNAL sss_got_run_lock WAIT_FOR sss_continue';
SHOW SLAVE STATUS;
connect stopper, 127.0.0.1, root, , , $SERVER_MYPORT_1;
SET @@SESSION.debug_sync= 'now WAIT_FOR sss_got_run_lock';
STOP SLAVE SQL_THREAD;
connect continuer, 127.0.0.1, root, , , $SERVER_MYPORT_1;
SET @@SESSION.debug_sync= 'now SIGNAL sss_continue';
connection stopper;
disconnect continuer;
connection default;
disconnect stopper;
SET @@SESSION.debug_sync= RESET;
include/wait_for_slave_sql_to_stop.inc
RESET SLAVE ALL;