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:
Category:MySQL Server: DML Severity:S5 (Performance)
Version:5.5, 5.1, ... OS:Any
Assigned to:
Triage: Needs Triage: D3 (Medium)

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

inline ulong sql_rnd_with_mutex()
  ulong tmp=(ulong) (my_rnd(&sql_rand) * 0xffffffff); /* make all bits random */
  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.