Deadlock between ha_innobase::innobase_lock_autoinc and galera::ReplicatorSMM::pre_commit

Bug #1377901 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL patches by Codership
New
Undecided
Unassigned

Bug Description

When executing the test case from LP1372986 , the master sometimes hangs with the following interesting threads:

Thread 3 (Thread 0x7fd9d0427700 (LWP 11929)):
#0 0x0000003f2e00bcf0 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x00007fd9eb39b645 in wait (this=0x7fd9d0424650, cond=...) at galerautils/src/gu_lock.hpp:56
#2 galera::Monitor<galera::ReplicatorSMM::CommitOrder>::enter (this=this@entry=0x2998b00, obj=...) at galera/src/monitor.hpp:120
#3 0x00007fd9eb395cd8 in galera::ReplicatorSMM::pre_commit (this=0x2997eb0, trx=0x7fd9a80be5b0, meta=<optimized out>) at galera/src/replicator_smm.cpp:764
#4 0x00007fd9eb3a6580 in galera_pre_commit (gh=<optimized out>, conn_id=7, trx_handle=<optimized out>, flags=<optimized out>, meta=0x2c00080) at galera/src/wsrep_provider.cpp:505
#5 0x00000000007bb0e0 in wsrep_run_wsrep_commit (thd=0x2bfdff0, hton=<optimized out>, all=<optimized out>) at /home/philips/git/codership-mysql/sql/wsrep_hton.cc:434
#6 0x00000000005c4fcd in ha_prepare_low (thd=0x2bfdff0, all=false) at /home/philips/git/codership-mysql/sql/handler.cc:2150
#7 0x00000000005c4393 in ha_commit_trans (thd=thd@entry=0x2bfdff0, all=all@entry=false, ignore_global_read_lock=ignore_global_read_lock@entry=false) at /home/philips/git/codership-mysql/sql/handler.cc:1457
#8 0x00000000007a23c7 in trans_commit_stmt (thd=thd@entry=0x2bfdff0) at /home/philips/git/codership-mysql/sql/transaction.cc:473
#9 0x0000000000712e5c in mysql_execute_command (thd=thd@entry=0x2bfdff0) at /home/philips/git/codership-mysql/sql/sql_parse.cc:5444
#10 0x000000000071a538 in mysql_parse (parser_state=0x7fd9d0426650, length=65, rawbuf=0x7fd9a8004bd0 "INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3", thd=0x2bfdff0) at /home/philips/git/codership-mysql/sql/sql_parse.cc:6815
#11 wsrep_mysql_parse (thd=thd@entry=0x2bfdff0, rawbuf=0x7fd9a8004bd0 "INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3", length=65, parser_state=parser_state@entry=0x7fd9d0426650) at /home/philips/git/codership-mysql/sql/sql_parse.cc:6595
#12 0x000000000071bd3f in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x2bfdff0, packet=packet@entry=0x2c72021 "INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3;", packet_length=packet_length@entry=66) at /home/philips/git/codership-mysql/sql/sql_parse.cc:1525
#13 0x000000000071dc22 in do_command (thd=0x2bfdff0) at /home/philips/git/codership-mysql/sql/sql_parse.cc:1114
#14 0x00000000006e1c65 in do_handle_one_connection (thd_arg=thd_arg@entry=0x2bfdff0) at /home/philips/git/codership-mysql/sql/sql_connect.cc:1007
#15 0x00000000006e1cc9 in handle_one_connection (arg=arg@entry=0x2bfdff0) at /home/philips/git/codership-mysql/sql/sql_connect.cc:916
#16 0x0000000000957240 in pfs_spawn_thread (arg=0x2c52a40) at /home/philips/git/codership-mysql/storage/perfschema/pfs.cc:1860
#17 0x0000003f2e007f35 in start_thread () from /lib64/libpthread.so.0
#18 0x0000003f2d8f4c3d in clone () from /lib64/libc.so.6

and

Thread 21 (Thread 0x7fd9e004c700 (LWP 11760)):
#0 0x0000003f2e00bcf0 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1 0x0000000000a2ad71 in os_cond_wait (fast_mutex=0x7fd9cc02ac70, cond=0x7fd9cc02acb0) at /home/philips/git/codership-mysql/storage/innobase/os/os0sync.cc:214
#2 os_event_wait_low (event=0x7fd9cc02ac70, reset_sig_count=<optimized out>, reset_sig_count@entry=0) at /home/philips/git/codership-mysql/storage/innobase/os/os0sync.cc:610
#3 0x0000000000a10c22 in lock_wait_suspend_thread (thr=thr@entry=0x7fd9cc0282f0) at /home/philips/git/codership-mysql/storage/innobase/lock/lock0wait.cc:344
#4 0x0000000000a67e34 in row_mysql_handle_errors (savept=0x0, savept=0x0, thr=0x7fd9cc0282f0, trx=0x7fd9cc0289f8, new_err=<synthetic pointer>) at /home/philips/git/codership-mysql/storage/innobase/row/row0mysql.cc:631
#5 row_lock_table_autoinc_for_mysql (prebuilt=0x7fd9cc027bf8) at /home/philips/git/codership-mysql/storage/innobase/row/row0mysql.cc:1126
#6 0x00000000009dcc1c in ha_innobase::innobase_lock_autoinc (this=0x7fd9cc025c90) at /home/philips/git/codership-mysql/storage/innobase/handler/ha_innodb.cc:6907
#7 0x00000000009e183b in innobase_set_max_autoinc (auto_inc=3, this=0x7fd9cc025c90) at /home/philips/git/codership-mysql/storage/innobase/handler/ha_innodb.cc:6958
#8 ha_innobase::write_row (this=0x7fd9cc025c90, record=0x7fd9cc0277b0 "\375\002") at /home/philips/git/codership-mysql/storage/innobase/handler/ha_innodb.cc:7273
#9 0x00000000005cb48f in handler::ha_write_row (this=0x7fd9cc025c90, buf=0x7fd9cc0277b0 "\375\002") at /home/philips/git/codership-mysql/sql/handler.cc:7370
#10 0x00000000008b6715 in Write_rows_log_event::write_row (this=this@entry=0x7fd9cc023120, rli=rli@entry=0x7fd9cc00baf0, overwrite=<optimized out>) at /home/philips/git/codership-mysql/sql/log_event.cc:12600
#11 0x00000000008b6a85 in Write_rows_log_event::do_exec_row (this=0x7fd9cc023120, rli=0x7fd9cc00baf0) at /home/philips/git/codership-mysql/sql/log_event.cc:12789
#12 0x00000000008a2996 in Rows_log_event::do_apply_row (this=this@entry=0x7fd9cc023120, rli=rli@entry=0x7fd9cc00baf0) at /home/philips/git/codership-mysql/sql/log_event.cc:10189
#13 0x00000000008b3bff in Rows_log_event::do_apply_event (this=0x7fd9cc023120, rli=0x7fd9cc00baf0) at /home/philips/git/codership-mysql/sql/log_event.cc:11326
#14 0x00000000008acabe in Log_event::apply_event (this=this@entry=0x7fd9cc023120, rli=0x7fd9cc00baf0) at /home/philips/git/codership-mysql/sql/log_event.cc:3024
#15 0x00000000005bd31c in wsrep_apply_events (buf_len=859, events_buf=0x7fd9e31b894e, thd=0x7fd9cc000990) at /home/philips/git/codership-mysql/sql/wsrep_applier.cc:151
#16 wsrep_apply_cb (ctx=0x7fd9cc000990, buf=0x7fd9e31b894e, buf_len=9177, flags=<optimized out>, meta=<optimized out>) at /home/philips/git/codership-mysql/sql/wsrep_applier.cc:238
#17 0x00007fd9eb3556b8 in galera::TrxHandle::apply (this=this@entry=0x7fd9cc00ee10, recv_ctx=recv_ctx@entry=0x7fd9cc000990, apply_cb=apply_cb@entry=0x5bcda0 <wsrep_apply_cb(void*, void const*, unsigned long, unsigned int, wsrep_trx_meta const*)>, meta=...) at galera/src/trx_handle.cpp:304
#18 0x00007fd9eb39163d in apply_trx_ws (recv_ctx=recv_ctx@entry=0x7fd9cc000990, apply_cb=0x5bcda0 <wsrep_apply_cb(void*, void const*, unsigned long, unsigned int, wsrep_trx_meta const*)>, commit_cb=0x5bd780 <wsrep_commit_cb(void*, unsigned int, wsrep_trx_meta const*, bool*, bool)>, trx=..., meta=...) at galera/src/replicator_smm.cpp:37
#19 0x00007fd9eb393870 in galera::ReplicatorSMM::apply_trx (this=this@entry=0x2997eb0, recv_ctx=recv_ctx@entry=0x7fd9cc000990, trx=trx@entry=0x7fd9cc00ee10) at galera/src/replicator_smm.cpp:420
#20 0x00007fd9eb39665e in galera::ReplicatorSMM::process_trx (this=0x2997eb0, recv_ctx=0x7fd9cc000990, trx=0x7fd9cc00ee10) at galera/src/replicator_smm.cpp:1212
#21 0x00007fd9eb373f98 in galera::GcsActionSource::dispatch (this=this@entry=0x2998508, recv_ctx=recv_ctx@entry=0x7fd9cc000990, act=..., exit_loop=@0x7fd9e004b2e0: false) at galera/src/gcs_action_source.cpp:116
#22 0x00007fd9eb37570c in galera::GcsActionSource::process (this=0x2998508, recv_ctx=0x7fd9cc000990, exit_loop=@0x7fd9e004b2e0: false) at galera/src/gcs_action_source.cpp:180
#23 0x00007fd9eb396b7b in galera::ReplicatorSMM::async_recv (this=0x2997eb0, recv_ctx=0x7fd9cc000990) at galera/src/replicator_smm.cpp:355
#24 0x00007fd9eb3a5748 in galera_recv (gh=<optimized out>, recv_ctx=<optimized out>) at galera/src/wsrep_provider.cpp:231
#25 0x00000000005bdcd0 in wsrep_replication_process (thd=0x7fd9cc000990) at /home/philips/git/codership-mysql/sql/wsrep_thd.cc:309
#26 0x00000000005a715b in start_wsrep_THD (arg=0x5bdc80 <wsrep_replication_process(THD*)>) at /home/philips/git/codership-mysql/sql/mysqld.cc:5373
#27 0x0000003f2e007f35 in start_thread () from /lib64/libpthread.so.0
#28 0x0000003f2d8f4c3d in clone () from /lib64/libc.so.6

Revision history for this message
Philip Stoev (philip-stoev-f) wrote :
Revision history for this message
Philip Stoev (philip-stoev-f) wrote :

innodb-autoinc-lock-mode = 1

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.