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)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 52737 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

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?