Bug 52737 - WaitHandle.WaitOne early returns on big timeouts
Summary: WaitHandle.WaitOne early returns on big timeouts
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 4.4.0 (C7)
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-24 11:24 UTC by Mirco Boschi
Modified: 2017-03-02 00:46 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Mirco Boschi 2017-02-24 11:24:43 UTC
Overview: If we call WaitOne on a ManualResetEvent with a big timeout, the timeout will not be respected.
E.G. specifying a timeout for 8 hours, the call will return in ~24 seconds.
See following snippet.

Step to reproduce: Compile the following snippet and run it

using System;
using System.Threading;

public class HelloWorld
{
    static public void Main ()
    {
        Console.WriteLine (DateTime.Now.ToString());

        ManualResetEvent ExitRequested = new ManualResetEvent(false);
        int ms = 1000*60*60*8;
        Console.WriteLine("Sleeping for " + ms.ToString() + " ms");
        ExitRequested.WaitOne(ms);
        Console.WriteLine ("Done");
        Console.WriteLine (DateTime.Now.ToString());
    }
}

Actual Result:

/opt/mono-4.4.0/bin/mcs sleep.cs && /opt/mono-4.4.0/bin/mono sleep.exe
24/02/2017 12:11:42
Sleeping for 28800000 ms
Done
24/02/2017 12:12:06

Expected result:
The program should complete in 8 hours.

Btw can this be related with #11805?

Note You need to log in before you can comment on or make changes to this bug.