Bug #17635 Sleep time long process after time clock adjust in system
Submitted: 22 Feb 2006 2:56 Modified: 23 Jan 2007 20:51
Reporter: Luis A S Junior Camargo Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.18 OS:Microsoft Windows (Windows 2000 Server SP4)
Assigned to: Magnus BlÄudd CPU Architecture:Any

[22 Feb 2006 2:56] Luis A S Junior Camargo
Description:
Sleep time value has bigger increasing after clock adjust in system.

How to repeat:
select sleep(3);
executed in 3 seconds

select sleep(5);
executed in 5 seconds

select sleep(10);
executed in 10 seconds

Change the time clock of system from 10:00 to 09:00 (for example)

select sleep(3);
after 30 minutes the query is not processed

select sleep(5);
after 30 minutes the query is not processed

select sleep(10);
after 30 minutes the query is not processed

Suggested fix:
I unknow, after restart the MySQL the problem is solved.
[22 Feb 2006 3:37] Luis A S Junior Camargo
Finally the query is processed, i have changed the time clock at 5 days ago without restart the MySQL service, the wrong interval is equal with interval change in system,  this is a query result of my last post:

mysql> select sleep(0);
+----------+
| sleep(0) |
+----------+
|        0 |
+----------+
1 row in set (1 hour 7.75 sec)

mysql> select sleep(1);
+----------+
| sleep(1) |
+----------+
|        0 |
+----------+
1 row in set (1 hour 8.31 sec)

mysql> select sleep(10);
+-----------+
| sleep(10) |
+-----------+
|         0 |
+-----------+
1 row in set (1 hour 17.56 sec)
[17 May 2006 17:46] Miguel Solorzano
Thank you for the bug report. On Windows the sleep uses the Win32 API
Sleep() function:

#elif defined(__WIN__)
  Sleep(m_seconds/1000+1);      /* Sleep() has millisecond arg */
#elif defined(OS2)

Maybe another method can be used or just can't be fixed.
[26 Oct 2006 0:34] 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/14411

ChangeSet@1.2328, 2006-10-25 20:34:13-04:00, iggy@amd64. +1 -0
  Bug#17635 Sleep time long process after time clock adjust in system.
  - Windows version of my_getsystime() only checked the local system time
  the first time it was called.  Changes to system time would either delay
  or increase the sleep period by the amount of time changed.
[23 Jan 2007 20:51] Paul Dubois
Noted in 5.0.36, 5.1.15 changelogs.

On Windows, the SLEEP() function could sleep too long, especially
after a change to the system clock.