Bug #62282 LOCK_thread_count is used for random functions

Submitted: 28 Aug 2011 21:52 Modified: 31 May 2012 17:31
Reporter: Domas Mituzas Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S5 (Performance)
Version:5.5, 5.1, ... OS:Any
Assigned to: CPU Architecture:Any

[28 Aug 2011 21:52] Domas Mituzas
Description:
functions like UUID() as well as THD::THD() initializer is calling:

inline ulong sql_rnd_with_mutex()
{
  mysql_mutex_lock(&LOCK_thread_count);
  ulong tmp=(ulong) (my_rnd(&sql_rand) * 0xffffffff); /* make all bits random */
  mysql_mutex_unlock(&LOCK_thread_count);
  return tmp;
}

How to repeat:
run MySQL

Suggested fix:
use separate mutex, don't call this function in THD initializer (slows down accepts), use lockless rand algorithm?
[31 May 2012 17:31] Paul DuBois
Noted in 5.6.6 changelog.

An inappropriate mutex was used to protect random number generation,
causing contention during connect operations.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.048 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.