[MDEV-15889] Semisync ack thread hits an LOCK_plugin assert at shutdown Created: 2018-04-16  Updated: 2018-04-17  Resolved: 2018-04-17

Status: Closed
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.3
Fix Version/s: 10.3.7

Type: Bug Priority: Critical
Reporter: Andrei Elkin Assignee: Andrei Elkin
Resolution: Fixed Votes: 0
Labels: None


 Description   

The semisync ack thread finds LOCK_plugin mutex uninitialized at time
the thread is shut down due to an error in init_server_components():

#1  0x00007ffff64f337a in __GI_abort () at abort.c:89
#2  0x00005555566a0ce3 in safe_mutex_lock (mp=0x5555573a1dc0 <LOCK_plugin>, my_flags=0, file=0x5555567bb750 "/home/andrei/MDB/WTs/10.3/sql/sql_plugin.cc", line=3254) at thr_mutex.c:246
#3  0x0000555555c1dc9c in inline_mysql_mutex_lock (that=0x5555573a1dc0 <LOCK_plugin>, src_file=0x5555567bb750 "/home/andrei/MDB/WTs/10.3/sql/sql_plugin.cc", src_line=3254) at mysql_thread.h:710
#4  0x0000555555c26bae in plugin_thdvar_cleanup (thd=0x7fffe0001b98) at sql_plugin.cc:3254
#5  0x0000555555ba6833 in THD::free_connection (this=0x7fffe0001b98) at sql_class.cc:1650
#6  0x0000555555ba6bee in THD::~THD (this=0x7fffe0001b98, __in_chrg=<optimized out>) at sql_class.cc:1725
#7  0x0000555555ba7098 in THD::~THD (this=0x7fffe0001b98, __in_chrg=<optimized out>) at sql_class.cc:1780
#8  0x0000555555de24bf in Ack_receiver::run (this=0x5555573c4e00 <ack_receiver>) at semisync_master_ack_receiver.cc:301
#9  0x0000555555de1561 in ack_receive_handler (arg=0x5555573c4e00 <ack_receiver>) at semisync_master_ack_receiver.cc:35
#10 0x0000555556635872 in pfs_spawn_thread (arg=0x555557da92a8) at pfs.cc:1862

The mutex is actually destroyed few instructions earlier by another thread that
initiates the Ack thread exit:

#0  inline_mysql_mutex_destroy (that=0x5555573a1dc0 <LOCK_plugin>, src_file=0x5555567bb750 "/home/andrei/MDB/WTs/10.3/sql/sql_plugin.cc", src_line=2078) at mysql_thread.h:662
#1  0x0000555555c2347e in plugin_shutdown () at sql_plugin.cc:2078
#2  0x0000555555ae931e in clean_up (print_message=true) at mysqld.cc:2243
#3  0x0000555555ae9028 in unireg_abort (exit_code=2) at mysqld.cc:2159
#4  0x0000555555aefaf9 in init_server_components () at mysqld.cc:5421
#5  0x0000555555af0b1c in mysqld_main (argc=153, argv=0x555557c51698) at mysqld.cc:

Relocation semi_sync_master_deinit() to run before plugin_shutdown() deems to fix this case.



 Comments   
Comment by Andrei Elkin [ 2018-04-16 ]

Sergei, hello.

Here is a patch for a different issue that the former MDEV-15796
shadowed. This time dependency between the plugin and not-plugin-anymore
semisync plays at shutdown.
I hope you'll find time to review.

Many thanks!

Andrei

Comment by Sergey Vojtovich [ 2018-04-16 ]

Ok to push.

Comment by Andrei Elkin [ 2018-04-17 ]

02e897ca571 pushed to 10.3.7.

Generated at Thu Feb 08 08:24:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.