MDEV-30084 Shutdown hangs in some tests

debug-only issue. the test was doing

  set debug_sync='now SIGNAL go3';
  ...
  set debug_sync='reset';

which translated into

  add "go3" to the hash of active signals
  pthread_broadcast to wake up waiting threads
  ...
  clear the hash of active signals

as a result a waiting thread was awoken, but the hash was emptied
before the thread checked if its signal was in the hash. so the
thread didn't find its signal and went back to sleep.

let's wait until the awoken thread has completely finished
disconnecting and was added to the thread cache.
This commit is contained in:
Sergei Golubchik 2023-07-03 22:05:02 +02:00
parent f6ecadfee8
commit 46b79b8cd1
2 changed files with 7 additions and 0 deletions

View file

@ -234,6 +234,7 @@ connection default;
set debug_sync='now WAIT_FOR go0';
set debug_sync='found_killee SIGNAL go1 WAIT_FOR go2';
kill $id;
select variable_value into @threads_cached from information_schema.global_status where variable_name='threads_cached';
set debug_sync='now SIGNAL go3';
drop table t1;
set debug_sync='reset';

View file

@ -313,6 +313,12 @@ connection default;
set debug_sync='now WAIT_FOR go0';
set debug_sync='found_killee SIGNAL go1 WAIT_FOR go2';
evalp kill $id;
select variable_value into @threads_cached from information_schema.global_status where variable_name='threads_cached';
set debug_sync='now SIGNAL go3';
if (`select @@thread_handling != 'pool-of-threads'`) {
# cannot check that a thread was added to thread pool on windows, but the test works there w/o the wait
let wait_condition= select variable_value>@threads_cached from information_schema.global_status where variable_name='threads_cached';
source include/wait_condition.inc;
}
drop table t1;
set debug_sync='reset';