Bug #32059 thread_id is a long rather than ulong
Submitted: 2 Nov 2007 18:36 Modified: 28 Apr 2008 13:19
Reporter: Matthew Lord Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:all OS:Any
Assigned to: Kristofer Pettersson CPU Architecture:Any
Tags: rollover, thread_id

[2 Nov 2007 18:36] Matthew Lord
Description:
thread_id is a long rather than a ulong.  The reason this is an issue is because
we don't ever reset it back to 1, we seem to rely on the value "rolling over" when
the type max is reached (4294967295 for a ulong).  We are currently using a signed 
long which means that when we reach the limit (2147483647) it will roll over to
-2147483647 instead of 1.

How to repeat:
n/a

Suggested fix:
change
static long thread_id = 0;
to 
static ulong thread_id = 0;

This will double the valid thread id range but more importantly allow us
to "rollover" correctly when the type limit is reached.
[18 Mar 2008 13:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/44176

ChangeSet@1.2596, 2008-03-18 14:24:52+01:00, thek@adventure.(none) +1 -0
  Bug#32059 thread_id is a long rather than ulong
  
  thread_id should be defined as a dword (32 bit unsigned).
[25 Mar 2008 8:22] Kristofer Pettersson
Already fixed for 5.1
[26 Mar 2008 15:39] Kristofer Pettersson
5.0 (only) patch approved by Kostja.
[20 Apr 2008 13:00] Bugs System
Pushed into 6.0.6-alpha
[28 Apr 2008 13:19] Paul DuBois
No changelog entry needed.
[20 May 2008 21:22] Bugs System
Pushed into 5.1.25-rc
[28 Jul 2008 16:53] Bugs System
Pushed into 5.1.25-rc  (revid:sp1r-kostja@bodhi.(none)-20080520073817-17550) (version source revid:sp1r-kostja@bodhi.(none)-20080520073817-17550) (pib:3)