← Back to team overview

enterprise-support team mailing list archive

[Bug 1521564] [NEW] Remove sync_arr_wake_threads_if_sema_free hack

 

Public bug reported:

Copy of https://bugs.mysql.com/bug.php?id=79477:

[1 Dec 10:36] Laurynas Biveinis
Description:
InnoDB error monitor thread has code to wake up missed mutex/rwlock waiters. This code is commented to be necessary in case of lock word reset not being ordered with waiters flag read properly:

		/* A problem: we assume that mutex_reset_lock word
		is a memory barrier, that is when we read the waiters
		field next, the read must be serialized in memory
		after the reset. A speculative processor might
		perform the read first, which could leave a waiting
		thread hanging indefinitely. */

This code should go away if event-based mutex stays, because:
- all the barriers can be implemented properly using proper means such as compiler intrincs;
- in case the scenario being protected against happens and this thread saves the day, it's still possibly a ~0.5 second stall;
- the scenario might happen when the thread is not running (--innodb-read-only, server startup);
- the scenario might happen on e.g. log sys mutex, and the error monitor thread itself will block on that mutex at the start of the loop (BTW that code for checking that LSN is not going backwards could be removed as well);
- less code.

How to repeat:
Code analysis

Suggested fix:
Remove sync_arr_wake_threads_if_sema_free(), sync_arr_cell_can_wake_up(), sync_array_wake_threads_if_sema_free_low(). Review that the mutex lock_word / waiters are properly synchronised by barriers.

** Affects: mysql-server
     Importance: Unknown
         Status: Unknown

** Affects: percona-server
     Importance: Wishlist
         Status: Triaged

** Affects: percona-server/5.5
     Importance: Wishlist
         Status: Triaged

** Affects: percona-server/5.6
     Importance: Wishlist
         Status: Triaged

** Affects: percona-server/5.7
     Importance: Wishlist
     Assignee: Laurynas Biveinis (laurynas-biveinis)
         Status: Fix Committed


** Tags: innodb upstream

** Also affects: percona-server/5.5
   Importance: Undecided
       Status: New

** Also affects: percona-server/5.7
   Importance: Undecided
       Status: New

** Also affects: percona-server/5.6
   Importance: Undecided
       Status: New

** Changed in: percona-server/5.7
     Assignee: (unassigned) => Laurynas Biveinis (laurynas-biveinis)

** Changed in: percona-server/5.7
    Milestone: None => 5.7.9-1

** Changed in: percona-server/5.7
   Importance: Undecided => Wishlist

** Changed in: percona-server/5.6
   Importance: Undecided => Wishlist

** Changed in: percona-server/5.5
   Importance: Undecided => Wishlist

** Changed in: percona-server/5.5
       Status: New => Triaged

** Changed in: percona-server/5.6
       Status: New => Triaged

** Changed in: percona-server/5.7
       Status: New => In Progress

** Tags added: innodb upstream

** Bug watch added: MySQL Bug System #79477
   http://bugs.mysql.com/bug.php?id=79477

** Also affects: mysql-server via
   http://bugs.mysql.com/bug.php?id=79477
   Importance: Unknown
       Status: Unknown

** Changed in: percona-server/5.7
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of Ubuntu
Server/Client Support Team, which is subscribed to MySQL.
Matching subscriptions: Ubuntu Server/Client Support Team
https://bugs.launchpad.net/bugs/1521564

Title:
  Remove sync_arr_wake_threads_if_sema_free hack

To manage notifications about this bug go to:
https://bugs.launchpad.net/mysql-server/+bug/1521564/+subscriptions


Follow ups