## This test-case was created for reproducing a Valgrind issue that occure # between two session, one lising all session and second that is authenticating. --source include/have_debug_sync.inc --source include/have_debug.inc --source include/xplugin_preamble.inc --source include/xplugin_create_user.inc --echo ## I. Reproduce race condition between authenticating session and listing --echo # session: --echo # 1. Create X Protocol session(X1) using "x_root" account and hang it while --echo # authenticating (sync point: syncpoint_xpl_switch_to_user_execute, syncpoint_xpl_switch_to_user_enter) --echo # 2. Create classic protocol session(C1) and list all session, --echo # hang it at "x_root" row generation --echo # 3. Ensure that X1, changes session user, after that wakeup C1 --echo # 4. Show at C1, processlist results --echo ## Test Setup --let $xtest_file= $MYSQL_TMP_DIR/admin_ping_mysqlx.xpl --write_file $xtest_file SELECT 'ok'; EOF ## Test execution --echo --echo # --echo # I.1 --let $debug_point= syncpoint_xpl_switch_to_user_enter --source include/add_debug_point.inc --let $debug_point= syncpoint_xpl_switch_to_user_execute --source include/add_debug_point.inc --let $debug_point= test_fill_proc_with_x_root --source include/add_debug_point.inc --exec_in_background $MYSQLXTEST -ux_root --password='' --ssl-mode=required --plain-auth --file=$xtest_file 2>&1 # The X Plugin assignes the account several times, thus we skip first one # and hand on second switch SET SESSION DEBUG_SYNC="now WAIT_FOR reached_xpl_switch_to_user_enter"; SET SESSION DEBUG_SYNC="now SIGNAL continue_xpl_switch_to_user_enter"; SET SESSION DEBUG_SYNC="now WAIT_FOR reached_xpl_switch_to_user_execute"; SET SESSION DEBUG_SYNC="now SIGNAL continue_xpl_switch_to_user_execute"; --echo --echo # --echo # I.2 # Switch to mysql.session localhost, stop in middle and list sessions # # Depending on the fix, 'x_root' account might be missing at the list # for this case lets ensure that we always emit 'reached_sql_show' signal SET SESSION DEBUG_SYNC="now WAIT_FOR reached_xpl_switch_to_user_enter"; --connect(con_async,localhost,root,,test) SET SESSION DEBUG_SYNC="fill_proc_list_ended SIGNAL reached_sql_show"; SET SESSION DEBUG_SYNC="fill_proc_list_with_x_root SIGNAL reached_sql_show WAIT_FOR continue_sql_show"; send SELECT IF(count(user),"Grater than zero", "None") as NoClients from information_schema.processlist order by user; --echo --echo # --echo # I.3 --connection default SET SESSION DEBUG_SYNC="now WAIT_FOR reached_sql_show"; SET SESSION DEBUG_SYNC="now SIGNAL continue_xpl_switch_to_user_enter"; SET SESSION DEBUG_SYNC="now WAIT_FOR reached_xpl_switch_to_user_execute"; SET SESSION DEBUG_SYNC="now SIGNAL continue_sql_show"; --echo --echo # --echo # I.4 --connection con_async --reap --disconnect con_async --source include/wait_until_disconnected.inc --connection default ## Cleanup --let $debug_point= syncpoint_xpl_switch_to_user_enter --source include/remove_debug_point.inc --let $debug_point= syncpoint_xpl_switch_to_user_execute --source include/remove_debug_point.inc --let $debug_point= test_fill_proc_with_x_root --source include/remove_debug_point.inc SET SESSION DEBUG_SYNC="now SIGNAL continue_xpl_switch_to_user_execute"; # No socket should be reported by X Plugin before user is dropped let $wait_condition= SELECT count(*)= 0 as Num FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE 'wait/io/socket/mysqlx/client_connection'; --source include/wait_condition_or_abort.inc SET SESSION DEBUG_SYNC="RESET"; --remove_file $xtest_file 30 --source ../include/xplugin_cleanup.inc