Bug #52241 void reference_table_share(TABLE_SHARE*): Assertion `share->ref_count' failed.
Submitted: 20 Mar 2010 10:44 Modified: 28 Sep 2010 12:36
Reporter: Philip Stoev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Locking Severity:S2 (Serious)
Version:trunk-runtime-exp OS:Any
Assigned to: CPU Architecture:Any

[20 Mar 2010 10:44] Philip Stoev
Description:
When executing a MDL/DDL workload involving various forms of FLUSH, mysqld asserted as follows:

mysqld: /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_base.cc:745: void reference_table_share(TABLE_SHARE*): Assertion `share->ref_count' failed.

# 12:41:15 #6  0x000000315a42bec9 in __assert_fail () from /lib64/libc.so.6
# 12:41:15 #7  0x000000000055625f in reference_table_share (share=0x28236d8) at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_base.cc:745
# 12:41:15 #8  0x0000000000563c8d in open_table (thd=0x28343a8, table_list=0x7f55117538a0, mem_root=0x2836d48, ot_ctx=0x7f5511753770, flags=4123)
# 12:41:15     at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_base.cc:2961
# 12:41:15 #9  0x0000000000564222 in open_ltable (thd=0x28343a8, table_list=0x7f55117538a0, lock_type=TL_WRITE_CONCURRENT_INSERT, lock_flags=4123)
# 12:41:15     at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_base.cc:5148
# 12:41:15 #10 0x0000000000564510 in open_log_table (thd=0x28343a8, one_table=0x7f55117538a0, backup=0x7f5511753fc0)
# 12:41:15     at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_base.cc:9009
# 12:41:15 #11 0x00000000007b28c3 in Log_to_csv_event_handler::log_general (this=0x27a7be0, thd=0x28343a8, event_time=1269081670,
# 12:41:15     user_host=0x7f55117540b0 "root[root] @ localhost [127.0.0.1]", user_host_len=34, thread_id=9, command_type=0xa8ed65 "Query", command_type_len=5,
# 12:41:15     sql_text=0x2826398 "/* testdb_N */ SELECT * FROM information_schema . schemata WHERE schema_name = TRIM(' testdb_N ')", sql_text_len=97,
# 12:41:15     client_cs=0x1048c80) at /1tb/bzr/mysql-trunk-runtime-exp/sql/log.cc:489
# 12:41:15 #12 0x00000000007b11ed in LOGGER::general_log_write (this=0x116ab00, thd=0x28343a8, command=COM_QUERY,
# 12:41:15     query=0x2826398 "/* testdb_N */ SELECT * FROM information_schema . schemata WHERE schema_name = TRIM(' testdb_N ')", query_length=97)
# 12:41:15     at /1tb/bzr/mysql-trunk-runtime-exp/sql/log.cc:1176
# 12:41:15 #13 0x00000000007b129d in general_log_write (thd=0x28343a8, command=COM_QUERY,
# 12:41:15     query=0x2826398 "/* testdb_N */ SELECT * FROM information_schema . schemata WHERE schema_name = TRIM(' testdb_N ')", query_length=97)
# 12:41:15     at /1tb/bzr/mysql-trunk-runtime-exp/sql/log.cc:4802
# 12:41:15 #14 0x00000000005b25bf in dispatch_command (command=COM_QUERY, thd=0x28343a8,
# 12:41:15     packet=0x27ebaa9 "/* testdb_N */ SELECT * FROM information_schema . schemata WHERE schema_name = TRIM(' testdb_N ')", packet_length=97)
# 12:41:15     at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_parse.cc:1018
# 12:41:15 #15 0x00000000005b3ae6 in do_command (thd=0x28343a8) at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_parse.cc:710
# 12:41:15 #16 0x000000000067e1e8 in do_handle_one_connection (thd_arg=0x28343a8) at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_connect.cc:1174
# 12:41:15 #17 0x000000000067e2b7 in handle_one_connection (arg=0x28343a8) at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_connect.cc:1113
# 12:41:15 #18 0x000000315b0073da in start_thread () from /lib64/libpthread.so.0
# 12:41:15 #19 0x000000315a4e627d in clone () from /lib64/libc.so.6

How to repeat:
If this is repeatable, a test case will be uploaded shortly
[20 Mar 2010 11:06] Philip Stoev
Grammar:

query:
        FLUSH TABLES WITH READ LOCK ; UNLOCK TABLES;

To reproduce:

$ perl runall.pl \
  --grammar=conf/bug52241.yy \
  --gendata=conf/WL5004_data.zz \
  --basedir=/1tb/bzr/mysql-trunk-runtime-exp/

Not reproducible  on next-mr
[20 Mar 2010 11:11] Philip Stoev
Here is another backtrace obtained using just concurrent FLUSH TABLES WITH READ LOCK:

# 12:59:19 #2  0x000000000051b5fc in handle_segfault (sig=11) at /1tb/bzr/mysql-trunk-runtime-exp/sql/mysqld.cc:2749
# 12:59:19 #3  <signal handler called>
# 12:59:19 #4  0x000000000056730b in I_P_List<TABLE, TABLE_share, I_P_List_null_counter>::push_front (this=0x2233a98, a=0x7f8f2c043178)
# 12:59:19     at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_plist.h:75
# 12:59:19 #5  0x00000000005556a5 in table_def_add_used_table (thd=0x7f8f2c031378, table=0x7f8f2c043178) at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_base.cc:344
# 12:59:19 #6  0x0000000000563c84 in open_table (thd=0x7f8f2c031378, table_list=0x7f8f31bb38a0, mem_root=0x7f8f2c033d18, ot_ctx=0x7f8f31bb3770, flags=4123)
# 12:59:19     at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_base.cc:2960
# 12:59:19 #7  0x0000000000564222 in open_ltable (thd=0x7f8f2c031378, table_list=0x7f8f31bb38a0, lock_type=TL_WRITE_CONCURRENT_INSERT, lock_flags=4123)
# 12:59:19     at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_base.cc:5148
# 12:59:19 #8  0x0000000000564510 in open_log_table (thd=0x7f8f2c031378, one_table=0x7f8f31bb38a0, backup=0x7f8f31bb3fc0)
# 12:59:19     at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_base.cc:9009
# 12:59:19 #9  0x00000000007b28c3 in Log_to_csv_event_handler::log_general (this=0x2d86be0, thd=0x7f8f2c031378, event_time=1269082756,
# 12:59:19     user_host=0x7f8f31bb40b0 "root[root] @ localhost [127.0.0.1]", user_host_len=34, thread_id=6, command_type=0xa8ed65 "Query", command_type_len=5,
# 12:59:19     sql_text=0x2daa4e8 "FLUSH TABLES WITH READ LOCK", sql_text_len=27, client_cs=0x1048c80) at /1tb/bzr/mysql-trunk-runtime-exp/sql/log.cc:489
# 12:59:19 #10 0x00000000007b11ed in LOGGER::general_log_write (this=0x116ab00, thd=0x7f8f2c031378, command=COM_QUERY, query=0x2daa4e8 "FLUSH TABLES WITH READ LOCK",
# 12:59:19     query_length=27) at /1tb/bzr/mysql-trunk-runtime-exp/sql/log.cc:1176
# 12:59:19 #11 0x00000000007b129d in general_log_write (thd=0x7f8f2c031378, command=COM_QUERY, query=0x2daa4e8 "FLUSH TABLES WITH READ LOCK", query_length=27)
# 12:59:19     at /1tb/bzr/mysql-trunk-runtime-exp/sql/log.cc:4802
# 12:59:19 #12 0x00000000005b25bf in dispatch_command (command=COM_QUERY, thd=0x7f8f2c031378, packet=0x7f8f2c03f139 "FLUSH TABLES WITH READ LOCK", packet_length=27)
# 12:59:19     at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_parse.cc:1018
# 12:59:19 #13 0x00000000005b3ae6 in do_command (thd=0x7f8f2c031378) at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_parse.cc:710
# 12:59:19 #14 0x000000000067e1e8 in do_handle_one_connection (thd_arg=0x7f8f2c031378) at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_connect.cc:1174
# 12:59:19 #15 0x000000000067e2b7 in handle_one_connection (arg=0x7f8f2c031378) at /1tb/bzr/mysql-trunk-runtime-exp/sql/sql_connect.cc:1113
# 12:59:19 #16 0x000000315b0073da in start_thread () from /lib64/libpthread.so.0
# 12:59:19 #17 0x000000315a4e627d in clone () from /lib64/libc.so.6
[1 Apr 2010 11:57] Konstantin Osipov
This is a dup of Bug#52266