Bug #47024 server hangs on FLUSH TABLES WITH READ LOCK or UNLOCK TABLES
Submitted: 31 Aug 2009 15:31 Modified: 10 Sep 2009 12:58
Reporter: Matthias Leich Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Locking Severity:S3 (Non-critical)
Version:5.4 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: regression

[31 Aug 2009 15:31] Matthias Leich
Description:
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings

--source include/have_innodb.inc

CREATE TABLE t1 (f1 BIGINT);
START TRANSACTION;
CREATE TEMPORARY TABLE t2 LIKE t1;

connect (con1,localhost,root,,test);
# Here the session hangs endless
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;

# Cleanup
disconnect con1;
--source include/wait_until_disconnected.inc
connection default;
DROP TABLE t1;
DROP TABLE t2;

Please note that if you
- remove the FLUSH TABLES the session hangs endless
  when executing the UNLOCK TABLES
- remove the START TRANSACTION or create t2 as non
  temporary table, the problem disappears
- use MySQL 5.0/5.1 instead of mysql-next-bugfixing (5.4)
  the problem also disappears

Backtrace after killall -11 mysqld:
-----------------------------------
Thread 2 (process 6495):
#0  0x00007fcb915e7dd9 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x0000000000b37dbd in safe_cond_wait (cond=0x124e780, mp=0x124daa0, file=0xd2aacd "sql_base.cc", line=1057) at thr_mutex.c:423
#2  0x000000000075eda4 in close_cached_tables (thd=0x20f3888, tables=0x0, have_lock=false, wait_for_refresh=true) at sql_base.cc:1057
#3  0x00000000006fc195 in reload_acl_and_cache (thd=0x20f3888, options=16388, tables=0x0, write_to_binlog=0x43cec2af) at sql_parse.cc:6896
#4  0x0000000000707724 in mysql_execute_command (thd=0x20f3888) at sql_parse.cc:4058
#5  0x000000000070a192 in mysql_parse (thd=0x20f3888, inBuf=0x210e220 "FLUSH TABLES WITH READ LOCK", length=27, found_semicolon=0x43cecf20) at sql_parse.cc:5950
#6  0x000000000070adb0 in dispatch_command (command=COM_QUERY, thd=0x20f3888, packet=0x20fe409 "FLUSH TABLES WITH READ LOCK", packet_length=27) at sql_parse.cc:1062
#7  0x000000000070c254 in do_command (thd=0x20f3888) at sql_parse.cc:744
#8  0x00000000006f9703 in handle_one_connection (arg=0x20f3888) at sql_connect.cc:1163
#9  0x00007fcb915e4040 in start_thread () from /lib64/libpthread.so.0
#10 0x00007fcb9058508d in clone () from /lib64/libc.so.6
#11 0x0000000000000000 in ?? ()

My environment:
- mysql-next-bugfixing 2009-08-28
  mysql-5.1-bugteam late August 2009
  mysql-5.0-bugteam late August 2009
- ./BUILD/compile-pentium64-debug-max
- Linux OpenSuSE 11.0 (64 Bit)
- Intel Core2Duo

How to repeat:
See above
[10 Sep 2009 12:58] Jon Olav Hauglid
Duplicate of bug#46673 and no longer repeatable in next-bugfixing.