Numerous test failures due to NULL dereference in trx_search_latch_if_reserved()

Bug #1239630 reported by Laurynas Biveinis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Invalid
Undecided
Unassigned
5.1
Invalid
Undecided
Unassigned
5.5
Fix Released
Critical
Laurynas Biveinis
5.6
Invalid
Undecided
Unassigned

Bug Description

A large number of tests on trunk fail on debug builds. A sample test can be reduced to

--source include/have_innodb.inc

connect (a,localhost,root,,);
connect (b,localhost,root,,);

CREATE TABLE bug47622(
 `rule_key` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB;

connection a;

ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key);

DROP TABLE bug47622;

resulting in

Thread 1 (Thread 0x7fe3e2046700 (LWP 16007)):
#0 0x00007fe3ee198f2c in __pthread_kill (threadid=<optimized out>, signo=11) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:62
#1 0x0000000000904455 in my_write_core (sig=11) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/mysys/stacktrace.c:433
#2 0x000000000078587d in handle_fatal_signal (sig=11) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/signal_handler.cc:250
#3 <signal handler called>
#4 0x00000000009a4778 in trx_search_latch_release_if_reserved (trx=0x0) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/storage/innobase/include/trx0trx.ic:36
#5 0x00000000009a4cf3 in innobase_release_temporary_latches (hton=0x32c23f0, thd=0x3b01990) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/storage/innobase/handler/ha_innodb.cc:1139
#6 0x00000000009aa2fa in ha_innobase::open (this=0x7fe3d000ae50, name=0x7fe3d0008448 "./test/bug47622", mode=2, test_if_locked=2) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/storage/innobase/handler/ha_innodb.cc:4738
#7 0x000000000078a2ba in handler::ha_open (this=0x7fe3d000ae50, table_arg=0x7fe3d000a570, name=0x7fe3d0008448 "./test/bug47622", mode=2, test_if_locked=2) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/handler.cc:2346
#8 0x00000000006c0b17 in open_table_from_share (thd=0x3b01990, share=0x7fe3d00080b0, alias=0x7fe3d0004d48 "bug47622", db_stat=39, prgflag=44, ha_open_flags=0, outparam=0x7fe3d000a570, is_create_table=false) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/table.cc:2064
#9 0x00000000005afd92 in open_table (thd=0x3b01990, table_list=0x7fe3d0004d58, mem_root=0x7fe3e2041c90, ot_ctx=0x7fe3e2041c50) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/sql_base.cc:3131
#10 0x00000000005b238f in open_and_process_table (thd=0x3b01990, lex=0x3b036e0, tables=0x7fe3d0004d58, counter=0x7fe3e2041d24, flags=0, prelocking_strategy=0x7fe3e2041f50, has_prelocking_list=false, ot_ctx=0x7fe3e2041c50, new_frm_mem=0x7fe3e2041c90) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/sql_base.cc:4504
#11 0x00000000005b334d in open_tables (thd=0x3b01990, start=0x7fe3e2041d10, counter=0x7fe3e2041d24, flags=0, prelocking_strategy=0x7fe3e2041f50) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/sql_base.cc:5019
#12 0x00000000005b4226 in open_and_lock_tables (thd=0x3b01990, tables=0x7fe3d0004d58, derived=false, flags=0, prelocking_strategy=0x7fe3e2041f50) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/sql_base.cc:5623
#13 0x000000000069aabb in mysql_alter_table (thd=0x3b01990, new_db=0x7fe3d0005280 "test", new_name=0x0, create_info=0x7fe3e20434b0, table_list=0x7fe3d0004d58, alter_info=0x7fe3e20433f0, order_num=0, order=0x0, ignore=false) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/sql_table.cc:6018
#14 0x00000000008d8d35 in Alter_table_statement::execute (this=0x7fe3d0005348, thd=0x3b01990) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/sql_alter.cc:106
#15 0x000000000060e6a0 in mysql_execute_command (thd=0x3b01990) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/sql_parse.cc:4683
#16 0x00000000006113df in mysql_parse (thd=0x3b01990, rawbuf=0x7fe3d0004c30 "ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key)", length=48, parser_state=0x7fe3e2045140) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/sql_parse.cc:5924
#17 0x0000000000604957 in dispatch_command (command=COM_QUERY, thd=0x3b01990, packet=0x3b052a1 "ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key)", packet_length=48) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/sql_parse.cc:1081
#18 0x0000000000603b4d in do_command (thd=0x3b01990) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/sql_parse.cc:789
#19 0x00000000006f7ab0 in do_handle_one_connection (thd_arg=0x3b01990) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/sql_connect.cc:1500
#20 0x00000000006f75d7 in handle_one_connection (arg=0x3b01990) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/sql/sql_connect.cc:1415
#21 0x000000000099f06e in pfs_spawn_thread (arg=0x3ae5120) at /home/laurynas/percona/src/merge-5.5.34/Percona-Server/storage/perfschema/pfs.cc:1015
#22 0x00007fe3ee193f8e in start_thread (arg=0x7fe3e2046700) at pthread_create.c:311
#23 0x00007fe3ed478e1d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

This was caused by an incorrect lp:~akopytov/percona-server/ahi-fixes-5.5 merge to trunk (the original branch was correct, it was the merge necessitated by the GCA and trunk tip differences):

=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-08-23 07:35:34 +0000
+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-09-06 13:24:59 +0000
@@ -1123,9 +1123,8 @@

        trx = thd_to_trx(thd);

- if (trx != NULL) {
- trx_search_latch_release_if_reserved(trx);
- }
+ /* No-op in XtraDB */
+ trx_search_latch_release_if_reserved(trx);

        return(0);
 }

Related branches

tags: added: low-hanging-fruit xtradb
description: updated
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-3045

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.