Bug 42295 - [Regression] Premature exit of AutoResetEvent.WaitOne(timeoutInMs)
Summary: [Regression] Premature exit of AutoResetEvent.WaitOne(timeoutInMs)
Status: RESOLVED DUPLICATE of bug 42688
Alias: None
Product: Runtime
Classification: Mono
Component: io-layer (show other bugs)
Version: 4.4.0 (C7)
Hardware: PC Linux
: --- normal
Target Milestone: 4.6.0 (C8)
Assignee: Ludovic Henry
URL:
Depends on:
Blocks:
 
Reported: 2016-06-30 23:06 UTC by mamo
Modified: 2016-07-22 22:01 UTC (History)
6 users (show)

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


Attachments
timeout script (428 bytes, text/plain)
2016-06-30 23:06 UTC, mamo
Details


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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 42688

Description mamo 2016-06-30 23:06:50 UTC
Created attachment 16538 [details]
timeout script

We found that the AutoReset.WaitOne(timeoutInMs) is exiting prematurely in our code with 4.4.1 and not blocking for the entire timeout duration.

We are running mono version:
mono --version
Mono JIT compiler version 4.4.1 (Nightly 4.4.1.0/4747417 Thu Jun 30 06:24:08 PDT 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen


Using IronPython, below is a test script that exhibits the problem.  Notice that the first call to Timeout(2) blocks for 2min.  But the second call Timeout(30), which should block for 30 min, only blocks for 1min 22sec.
 

>>> import System
>>> import System.Threading
>>> from System.Threading import *
>>> from System import DateTime
>>>
>>> def Timeout(numMinutes):
...     event = AutoResetEvent(False)
...     start = DateTime.Now
...     print "Waiting..." + start.ToString()
...     event.WaitOne(numMinutes * 60 * 1000)
...     finished = DateTime.Now
...     diff = finished - start
...     print "Finished at: " + finished.ToString() + " Elapsed: " + diff.ToString()
...
>>>
>>> Timeout(2)
Waiting...6/30/2016 8:36:39 AM
Finished at: 6/30/2016 8:38:39 AM Elapsed: 00:02:00.0011030
>>>
>>>
>>>
>>>
>>> Timeout(30)
Waiting...6/30/2016 8:39:41 AM
Finished at: 6/30/2016 8:41:03 AM Elapsed: 00:01:22.0137040
Comment 1 David Evans 2016-07-01 04:19:08 UTC
We also reproduced the problem on 4.4.0.40 today, btw.
Comment 2 David Evans 2016-07-01 04:20:09 UTC
Problem does not occur on 4.0.4.1 which is what we're running on regularly now. I don't believe i've seen it when testing against 4.3.2.467 though I'm not 100% sure of that.
Comment 3 Łukasz Domeradzki 2016-07-06 03:38:58 UTC
This is the same as https://bugzilla.xamarin.com/show_bug.cgi?id=41701 - no need for duplicate.
Comment 4 Ludovic Henry 2016-07-22 22:01:17 UTC

*** This bug has been marked as a duplicate of bug 42688 ***