[MDEV-18096] The server would crash when has configs rpl_semi_sync_master_enabled = OFF rpl_semi_sync_master_wait_no_slave =OFF Created: 2018-12-28  Updated: 2019-04-23  Resolved: 2019-04-19

Status: Closed
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.3.8
Fix Version/s: 10.3.15

Type: Bug Priority: Blocker
Reporter: Ze Yang Assignee: Andrei Elkin
Resolution: Fixed Votes: 0
Labels: None


 Description   

The server would crash when has configs rpl_semi_sync_master_enabled = OFF rpl_semi_sync_master_wait_no_slave =OFF

How to repeat:

./mysqld --rpl_semi_sync_master_enabled=OFF --rpl_semi_sync_master_wait_no_slave=OFF

Dies with:
mysqld: /my/maria-10.3/sql/semisync_master.cc:973: int Repl_semi_sync_master::switch_off(): Assertion `m_active_tranxs != NULL' failed.

From original bug report:

stack_bottom = 0x0 thread_stack 0x40000
*** buffer overflow detected ***: /u01/mariadb/bin/mysqld terminated
======= Backtrace: =========
/lib64/libc.so.6(__fortify_fail+0x37)[0x7f6f9059c597]
/lib64/libc.so.6(+0x10c750)[0x7f6f9059a750]
/lib64/libc.so.6(+0x10e507)[0x7f6f9059c507]
/u01/mariadb/bin/mysqld(my_addr_resolve+0xda)[0x7f6f9327932a]
/u01/mariadb/bin/mysqld(my_print_stacktrace+0x1c2)[0x7f6f93262a22]
/u01/mariadb/bin/mysqld(handle_fatal_signal+0x357)[0x7f6f92cf04b7]
/lib64/libpthread.so.0(+0xf100)[0x7f6f9213d100]
/u01/mariadb/bin/mysqld(_ZN12Active_tranx24clear_active_tranx_nodesEPKcy+0xc6)[0x7f6f92c3f7d6]
/u01/mariadb/bin/mysqld(_ZN21Repl_semi_sync_master10switch_offEv+0x1e)[0x7f6f92c3fcae]
/u01/mariadb/bin/mysqld(_ZN21Repl_semi_sync_master11init_objectEv+0xd4)[0x7f6f92c3fe64]
/u01/mariadb/bin/mysqld(+0x4f2b3f)[0x7f6f92a60b3f]
/u01/mariadb/bin/mysqld(_Z11mysqld_mainiPPc+0x4b7)[0x7f6f92a67287]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f6f904afb15]
/u01/mariadb/bin/mysqld(+0x4ec7ed)[0x7f6f92a5a7ed]
 
353 int Repl_semi_sync_master::init_object()
 354 {
 355   int result;
 356
 357   m_init_done = true;
 358
 359   /* References to the parameter works after set_options(). */
 360   set_wait_timeout(rpl_semi_sync_master_timeout);
 361   set_trace_level(rpl_semi_sync_master_trace_level);
 362   set_wait_point(rpl_semi_sync_master_wait_point);
 363
 364   /* Mutex initialization can only be done after MY_INIT(). */
 365   mysql_mutex_init(key_LOCK_binlog,
 366                    &LOCK_binlog, MY_MUTEX_INIT_FAST);
 367   mysql_cond_init(key_COND_binlog_send,
 368                   &COND_binlog_send, NULL);
 369
370   if (rpl_semi_sync_master_enabled)
 371   {
 372     result = enable_master();
 373     if (!result)**
 374       result= ack_receiver.start(); /* Start the ACK thread. */
 375   }
 376   else
 377   {
 378     result = disable_master();
 379   }
 380
 381   /*
 382     If rpl_semi_sync_master_wait_no_slave is disabled, let's temporarily
 383     switch off semisync to avoid hang if there's none active slave.
 384   */
 385   if (!rpl_semi_sync_master_wait_no_slave)
 386     switch_off();
 387
 388   return result;
 389 }
 
 391 int Repl_semi_sync_master::enable_master()
 392 {
 393   int result = 0;
 394
 395   /* Must have the lock when we do enable of disable. */
 396   lock();
 397
 398   if (!get_master_enabled())
 399   {
 400     m_active_tranxs = new Active_tranx(&LOCK_binlog, m_trace_level);
 401     if (m_active_tranxs != NULL)
 
 
 964 int Repl_semi_sync_master::switch_off()
 965 {
 966   int result;
 967
 968   DBUG_ENTER("Repl_semi_sync_master::switch_off");
 969
 970   m_state = false;
 971
 972   /* Clear the active transaction list. */
 973   assert(m_active_tranxs != NULL);
 974   result = m_active_tranxs->clear_active_tranx_nodes(NULL, 0);
 975
 976   rpl_semi_sync_master_off_times++;

If get rpl_semi_sync_master_enabled off, the enable_master function would not called. the m_active_tranxs would be NULL. And as rpl_semi_sync_master_wait_no_slave is off, the switch_off func called, the assert false.



 Comments   
Comment by Andrei Elkin [ 2019-04-17 ]

A patch is ready for review. It's pushed to test in BB: 63119277b47 HEAD -> bb-10.3-andrei.

Comment by Andrei Elkin [ 2019-04-19 ]

42c58b87da0 pushed upon review by Monty.

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