| 1 |
## This test-case was created for reproducing a Valgrind issue that occure |
| 2 |
# between two session, one lising all session and second that is closing. |
| 3 |
|
| 4 |
--source include/have_debug_sync.inc |
| 5 |
--source include/have_debug.inc |
| 6 |
--source ../include/have_performance_schema_events_waits_history.inc |
| 7 |
|
| 8 |
--source include/xplugin_preamble.inc |
| 9 |
--source include/xplugin_create_user.inc |
| 10 |
|
| 11 |
--echo ## I. Reproduce race condition between closing session and listing |
| 12 |
--echo # session (BUG#31490241): |
| 13 |
--echo # 1. Create X Protocol session(X1) using "x_root" account and hang it while closing |
| 14 |
--echo # (sync point: srv_session_close) |
| 15 |
--echo # 2. Create classic protocol session(C1) and list all session, |
| 16 |
--echo # hang it at "x_root" row generation while waking X1 |
| 17 |
--echo # 3. Wait until the X1, is inside THD deregistration |
| 18 |
--echo # and wakeup C1 |
| 19 |
--echo # 4. Show at C1, processlist results |
| 20 |
--echo |
| 21 |
|
| 22 |
## Test Setup |
| 23 |
--let $xtest_file= $MYSQL_TMP_DIR/admin_ping_mysqlx.xpl |
| 24 |
--write_file $xtest_file |
| 25 |
|
| 26 |
SET DEBUG_SYNC= 'srv_session_close WAIT_FOR listing_x_root'; |
| 27 |
EOF |
| 28 |
|
| 29 |
--let $debug_point= test_fill_proc_with_x_root |
| 30 |
--source include/add_debug_point.inc |
| 31 |
|
| 32 |
# Connect C1 |
| 33 |
--connect(con1,localhost,root,,) |
| 34 |
SET DEBUG_SYNC= 'fill_proc_list_with_x_root SIGNAL listing_x_root WAIT_FOR continue_fill_proc'; |
| 35 |
|
| 36 |
|
| 37 |
## Test execution |
| 38 |
--echo |
| 39 |
--echo # |
| 40 |
--echo # I.1 connect X1 |
| 41 |
--exec $MYSQLXTEST -ux_root --password='' --file=$xtest_file 2>&1 |
| 42 |
|
| 43 |
--echo |
| 44 |
--echo # |
| 45 |
--echo # I.2 Use C1 and list all sessions |
| 46 |
send SELECT user from information_schema.processlist order by user; |
| 47 |
|
| 48 |
|
| 49 |
--echo |
| 50 |
--echo # |
| 51 |
--echo # I.3 |
| 52 |
# Go back to C0, wait for X1 |
| 53 |
--connection default |
| 54 |
let $wait_condition= |
| 55 |
select count(*) from performance_schema.events_waits_current |
| 56 |
where EVENT_NAME like 'wait/synch/mutex/sql/LOCK_thd_remove'; |
| 57 |
--source include/wait_condition_or_abort.inc |
| 58 |
|
| 59 |
# Wake up C1 |
| 60 |
SET DEBUG_SYNC= 'now SIGNAL continue_fill_proc'; |
| 61 |
|
| 62 |
--echo |
| 63 |
--echo # |
| 64 |
--echo # I.4 |
| 65 |
# Go back to C1, and receive process-list |
| 66 |
--connection con1 |
| 67 |
reap; |
| 68 |
|
| 69 |
## Cleanup |
| 70 |
--connection default |
| 71 |
|
| 72 |
--let $debug_point= test_fill_proc_with_x_root |
| 73 |
--source include/remove_debug_point.inc |
| 74 |
--source ../include/xplugin_cleanup.inc |