Comment 9 for bug 1236696

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : Re: InnoDB: Error: semaphore wait has lasted > 600 seconds. InnoDB: We intentionally crash the server, because it appears to be hung. 2013-10-07 16:29:16 7fc3ebfff700 InnoDB: Assertion failure in thread <nr> in file srv0srv.cc line 2124

    Race conditions between successful locks after having set the
    waiters flag and unlocks exist. If a lock (both priority mutex or
    priority RW lock not as a next-waiter) is successfully locked this
    way, the corresponding waiter flag is set even though other
    waiters on the corresponding event do not necessarily exist.
    Then, on unlock, this higher-priority event with no waiters might
    be signaled while a lower-priority event with waiters will not
    be signaled.

    This is fixable by adjusting priority mutex high_priority_waiters
    and rw lock high_priority_x_waiters and high_priority_s_waiters
    flags to be atomically incremented instead of setting to 1 and
    atomically decremented instead of doing nothing if locking
    succeeds after setting the flag. high_priority_wait_ex_waiter
    flag can be maintained as 0/1 as described in the previous
    comment.

    The already-existing mutex::waiters and lock::waiters flag need
    not to be adjusted this way as there are no lower-priority events
    below them. Although such adjustment would result in a bit less
    spurious wakeup events under load and might be done as needed in
    the future.