Bug #54925 Assertion `query_arg && mysql_bin_log.is_open()' on DROP TEMP TABLE
Submitted: 30 Jun 2010 22:34 Modified: 2 Sep 2010 14:29
Reporter: Elena Stepanova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.5.5-m3-debug OS:Any
Assigned to: Luis Soares CPU Architecture:Any
Tags: regression

[30 Jun 2010 22:34] Elena Stepanova
Description:
#5  0x00002b157679dfb0 in abort () from /lib64/libc.so.6
#6  0x00002b1576796286 in __assert_fail () from /lib64/libc.so.6
#7  0x000000000055502f in THD::binlog_query (this=0x1474e20, qtype=THD::STMT_QUERY_TYPE,
    query_arg=0x14d4f20 "DROP TEMPORARY TABLE IF EXISTS `t1` /* generated by server */", query_len=61, is_trans=false, direct=false,
    suppress_use=false, errcode=0) at mysql-5.5.5-m3/sql/sql_class.cc:4607
#8  0x00000000005eab44 in mysql_rm_table_part2 (thd=0x1474e20, tables=0x14fc168, if_exists=false, drop_temporary=false, drop_view=false,
    dont_log_query=false) at mysql-5.5.5-m3/sql/sql_table.cc:2266
#9  0x00000000005eae33 in mysql_rm_table (thd=0x1474e20, tables=0x14fc168, if_exists=0 '\0', drop_temporary=0 '\0')
    at mysql-5.5.5-m3/sql/sql_table.cc:1874
#10 0x000000000058115b in mysql_execute_command (thd=0x1474e20)
    at mysql-5.5.5-m3/sql/sql_parse.cc:3440
#11 0x00000000005849a7 in mysql_parse (thd=0x1474e20, inBuf=0x14fc0a0 "DROP TABLE t1", length=<value optimized out>,
    parser_state=0x4588bae0) at mysql-5.5.5-m3/sql/sql_parse.cc:5911
#12 0x0000000000585c26 in dispatch_command (command=COM_QUERY, thd=0x1474e20, packet=0x14f4071 "DROP TABLE t1", packet_length=13)
    at mysql-5.5.5-m3/sql/sql_parse.cc:1135
#13 0x0000000000586dd1 in do_command (thd=0x1474e20)
    at mysql-5.5.5-m3/sql/sql_parse.cc:807
#14 0x000000000062a812 in do_handle_one_connection (thd_arg=<value optimized out>)
    at mysql-5.5.5-m3/sql/sql_connect.cc:1196
#15 0x000000000062aa0c in handle_one_connection (arg=<value optimized out>)
    at mysql-5.5.5-m3/sql/sql_connect.cc:1135
#16 0x00000000009133ab in pfs_spawn_thread (arg=<value optimized out>)
    at mysql-5.5.5-m3/storage/perfschema/pfs.cc:1015
#17 0x00002b15761be143 in start_thread () from /lib64/libpthread.so.0
#18 0x00002b157682d8cd in clone () from /lib64/libc.so.6
#19 0x0000000000000000 in ?? ()

Version: '5.5.5-m3-debug-log'  
mysqld: mysql-5.5.5-m3/sql/sql_class.cc:4607: int THD::binlog_query(THD::enum_binlog_query_type, const char*, ulong, bool, bool, bool, int): Assertion `query_arg && mysql_bin_log.is_open()' failed.
100701  1:24:33 - mysqld got signal 6 ;

thd->query at 0x14fc0a0 = DROP TABLE t1
thd->thread_id=2
thd->killed=NOT_KILLED

The crash does not happen on 5.5.4-m3.
Might have something to do with bug#51839 fixed in 5.5.5-m3.

How to repeat:
# Run on debug version

SET SESSION BINLOG_FORMAT = ROW;
CREATE TEMPORARY TABLE t1 ( i INT );
DROP TABLE t1;
[1 Jul 2010 16:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/112697

3079 Luis Soares	2010-07-01
      BUG#54925: Assertion `query_arg && mysql_bin_log.is_open()' on
      DROP TEMP TABLE
      
      Cset: alfranio.correia@sun.com-20100420091043-4i6ouzozb34hvzhb
      introduced a change that made drop temporary table to be always
      logged if current statement log format was set to row. This is
      fine. However, logging operations, for a "DROP TABLE" statement
      in mysql_rm_table_part2, are not protected by first checking if
      the mysql_bin_log is open before proceeding to the actual
      logging. They only check the dont_log_query variable. This was
      actually uncovered by the aforementioned cset and not introduced
      by it.
      
      We fix this by extending the condition used in the "if" that
      wraps logging operations in mysql_rm_table_part2.
[5 Jul 2010 17:14] Konstantin Osipov
The patch is OK.
[8 Jul 2010 9:29] Luis Soares
Queued in mysql-trunk-bugfixing and merged to mysql-next-mr-bugfixing:
- http://pb2.norway.sun.com/web.py?template=push_details&push=1402801
- http://pb2.norway.sun.com/web.py?template=push_details&push=1402747
[23 Jul 2010 12:24] Bugs System
Pushed into mysql-trunk 5.5.6-m3 (revid:alik@sun.com-20100723121820-jryu2fuw3pc53q9w) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:18)
[23 Jul 2010 12:31] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100723121929-90e9zemk3jkr2ocy) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (pib:18)
[4 Aug 2010 15:36] Jon Stephens
Documented bugfix in the 5.5.6 changelog as follows:

        Setting binlong_format = ROW then creating and then dropping a
        temporary table led an assertion.

Set NM status, waiting for merge to next-mr.
[2 Sep 2010 14:29] Jon Stephens
Per discussion with Luís, no additional changelog entry needed. Closed.