runtime icon indicating copy to clipboard operation
runtime copied to clipboard

TickCountTest failed on Windows

Open stephentoub opened this issue 10 years ago • 11 comments

http://dotnet-ci.cloudapp.net/job/dotnet_corefx/job/windows_nt_release_prtest/2762/consoleFull

05:28:29      System.Tests.EnvironmentTickCount.TickCountTest [FAIL]
05:28:29         Assert+WrapperXunitException : File path: d:\j\workspace\windows_nt_re---5067c899\src\System.Runtime.Extensions\tests\System\Environment.TickCount.cs. Line: 16
05:28:29         ---- Assert.True() Failure
05:28:29         Expected: True
05:28:29         Actual:   False
05:28:29         Stack Trace:
05:28:29            d:\j\workspace\windows_nt_re---5067c899\src\Common\tests\System\Diagnostics\AssertWithCallerAttributes.cs(583,0): at Assert.WrapException(Exception e, String callerFilePath, Int32 callerLineNumber)
05:28:29            d:\j\workspace\windows_nt_re---5067c899\src\Common\tests\System\Diagnostics\AssertWithCallerAttributes.cs(578,0): at Assert.True(Boolean condition, String userMessage, String path, Int32 line)
05:28:29            ----- Inner Stack Trace -----
05:28:29            d:\j\workspace\windows_nt_re---5067c899\src\Common\tests\System\Diagnostics\AssertWithCallerAttributes.cs(571,0): at Assert.True(Boolean condition, String userMessage, String path, Int32 line)

stephentoub avatar Feb 25 '16 15:02 stephentoub

http://dotnet-ci.cloudapp.net/job/dotnet_corefx/job/windows_nt_debug_prtest/3758/consoleFull

JonHanna avatar Mar 20 '16 15:03 JonHanna

@stephentoub I wonder if this could be a case of TickCount overflowing as well? The code is like this:

int start = Environment.TickCount;
Assert.True(SpinWait.SpinUntil(() => Environment.TickCount > start, TimeSpan.FromSeconds(1)));

It seems like in some insanely rare scenario, the initial TickCount value could be somewhere near or equal to Int32.MaxValue, and all the rest of the reads (in the SpinWait) could have overflowed. Do we have such long-running Windows machines, as well?

mellinoe avatar Apr 18 '16 22:04 mellinoe

Do we have such long-running Windows machines, as well?

We do.

stephentoub avatar Apr 18 '16 22:04 stephentoub

Fixed by https://github.com/dotnet/corefx/pull/7868

stephentoub avatar Apr 30 '16 12:04 stephentoub

This just failed again: http://dotnet-ci.cloudapp.net/job/dotnet_corefx/job/master/job/windows_nt_debug_prtest/1162/consoleText

System.Tests.EnvironmentTickCount.TickCountTest [FAIL]
        Assert+WrapperXunitException : File path: D:\j\workspace\windows_nt_de---4526f5ff\src\System.Runtime.Extensions\tests\System\Environment.TickCount.cs. Line: 16
        ---- Assert.True() Failure
        Expected: True
        Actual:   False
        Stack Trace:
           D:\j\workspace\windows_nt_de---4526f5ff\src\Common\tests\System\Diagnostics\AssertWithCallerAttributes.cs(583,0): at Assert.WrapException(Exception e, String callerFilePath, Int32 callerLineNumber)
           D:\j\workspace\windows_nt_de---4526f5ff\src\Common\tests\System\Diagnostics\AssertWithCallerAttributes.cs(578,0): at Assert.True(Boolean condition, String userMessage, String path, Int32 line)
           D:\j\workspace\windows_nt_de---4526f5ff\src\System.Runtime.Extensions\tests\System\Environment.TickCount.cs(16,0): at System.Tests.EnvironmentTickCount.TickCountTest()
           ----- Inner Stack Trace -----
           D:\j\workspace\windows_nt_de---4526f5ff\src\Common\tests\System\Diagnostics\AssertWithCallerAttributes.cs(571,0): at Assert.True(Boolean condition, String userMessage, String path, Int32 line)

stephentoub avatar May 12 '16 02:05 stephentoub

Again on June 5 - Windows 7 Debug Outerloop

System.Tests.EnvironmentTickCount.TickCountTest (from (empty))

MESSAGE:
Assert+WrapperXunitException : File path: d:\j\workspace\outerloop_win---b280fd23\src\System.Runtime.Extensions\tests\System\Environment.TickCount.cs. Line: 16\r\n---- Assert.True() Failure\r\nExpected: True\r\nActual: False
+++++++++++++++++++
STACK TRACE:
at Assert.WrapException(Exception e, String callerFilePath, Int32 callerLineNumber) at Assert.True(Boolean condition, String userMessage, String path, Int32 line) at System.Tests.EnvironmentTickCount.TickCountTest() ----- Inner Stack Trace ----- at Assert.True(Boolean condition, String userMessage, String path, Int32 line)

joshfree avatar Jun 05 '16 23:06 joshfree

Looks like the server on which this was run has been up for 25 days, aka ~2^31 milliseconds and when Environment.TickCount wraps around.

stephentoub avatar Jun 05 '16 23:06 stephentoub

Just failed again: http://dotnet-ci.cloudapp.net/job/dotnet_corefx/job/master/job/windows_nt_debug_prtest/308/consoleText

System.Tests.EnvironmentTickCount.TickCountTest [FAIL]
        Assert+WrapperXunitException : File path: D:\j\workspace\windows_nt_de---4526f5ff\src\System.Runtime.Extensions\tests\System\Environment.TickCount.cs. Line: 19
        ---- TickCount did not increase after one second. start: 41731625, values tested: 41731625.
        Expected: True
        Actual:   False
        Stack Trace:
        Condition(s) not met: "ECExplicitCurvesSupported"
           D:\j\workspace\windows_nt_de---4526f5ff\src\Common\tests\System\Diagnostics\AssertWithCallerAttributes.cs(583,0): at Assert.WrapException(Exception e, String callerFilePath, Int32 callerLineNumber)
           D:\j\workspace\windows_nt_de---4526f5ff\src\Common\tests\System\Diagnostics\AssertWithCallerAttributes.cs(578,0): at Assert.True(Boolean condition, String userMessage, String path, Int32 line)
           D:\j\workspace\windows_nt_de---4526f5ff\src\System.Runtime.Extensions\tests\System\Environment.TickCount.cs(19,0): at System.Tests.EnvironmentTickCount.TickCountTest()
           ----- Inner Stack Trace -----
           D:\j\workspace\windows_nt_de---4526f5ff\src\Common\tests\System\Diagnostics\AssertWithCallerAttributes.cs(575,0): at Assert.True(Boolean condition, String userMessage, String path, Int32 line)

stephentoub avatar Sep 19 '16 00:09 stephentoub

Failed for me as well. Innerloop Windows_NT Debug Build and Test https://ci.dot.net/job/dotnet_corefx/job/master/job/windows_nt_debug_prtest/1764/consoleText System.Tests.EnvironmentTickCount.TickCountTest [FAIL]

    TickCount did not increase after one second. start: 4711531, values tested: 4711531.

    Expected: True

    Actual:   False

    Stack Trace:

    Condition(s) not met: \"ECExplicitCurvesSupported\"
       D:\j\workspace\windows_nt_de---4526f5ff\src\System.Runtime.Extensions\tests\System\Environment.TickCount.cs(19,0): at System.Tests.EnvironmentTickCount.TickCountTest()`

karajas avatar Oct 18 '16 17:10 karajas

@stephentoub In the failures it looks like we usually have only read one value in the SpinWait block, and never got a chance to read another value, due to bad scheduling luck. Maybe we should read once again after the SpinWait?

mellinoe avatar Oct 18 '16 18:10 mellinoe

Maybe we should read once again after the SpinWait?

Sounds reasonable.

stephentoub avatar Oct 18 '16 18:10 stephentoub