runtime icon indicating copy to clipboard operation
runtime copied to clipboard

threading.WaitForMultipleObjectsEx.test2 failed on CentOS7.1

Open wtgodbe opened this issue 10 years ago • 10 comments

http://dotnet-ci.cloudapp.net/job/dotnet_coreclr/job/master/job/checked_centos7.1/1435/testReport/threading/WaitForMultipleObjectsEx/test2/

This happened on July 9 in a test job on merged code. Worth some investigation (FWIW, I'm only seeing this 1 failure for this test).

wtgodbe avatar Jul 14 '16 19:07 wtgodbe

Output from the test:

MESSAGE: Expected thread to wait for 1000 ms (and not get interrupted). Interrupt Time: 500 ms, ThreadWaitDelta 771 +++++++++++++++++++ STACK TRACE:

sergiy-k avatar Jul 15 '16 17:07 sergiy-k

@wtgodbe Did this repro again?

CC @kouvel

gkhanna79 avatar Mar 06 '17 04:03 gkhanna79

Looks like this is still repro-ing occasionally: https://ci.dot.net/job/dotnet_coreclr/job/master/job/checked_centos7.1/1302/testReport/threading/WaitForMultipleObjectsEx/test2/

wtgodbe avatar Mar 06 '17 20:03 wtgodbe

@sergiy-k @adityamandaleeka @jkotas who owns PAL tests these days?

wtgodbe avatar Mar 06 '17 20:03 wtgodbe

Probably me for the threading ones, I'll take a look

kouvel avatar Mar 06 '17 20:03 kouvel

@wtgodbe - me for the rest of the PAL tests.

janvorli avatar Mar 06 '17 21:03 janvorli

failed again in job: runtime-coreclr ilasm 20200919.1

failed test: threading.WaitForMultipleObjectsEx.test2

CoreCLR Linux arm64 Checked ilasmroundtrip @ (Ubuntu.1804.Arm64.Open)[email protected]/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-a45aeeb-20190620155855

Error message

Expected thread to wait for 1000 ms (and get interrupted).
Interrupt Time: 500 ms,  ThreadWaitDelta 499


Stack trace

v-haren avatar Sep 21 '20 07:09 v-haren

failed again in job: runtime-coreclr jitstress2-jitstressregs 20201004.1

failed test: threading.WaitForMultipleObjectsEx.test2

CoreCLR Linux arm64 Checked jitstress2_jitstressregs3 @ (Ubuntu.1804.Arm64.Open)[email protected]/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-a45aeeb-20190620155855

Error message

Expected thread to wait for 1000 ms (and get interrupted).
Interrupt Time: 500 ms,  ThreadWaitDelta 499

Stack trace

v-haren avatar Oct 09 '20 06:10 v-haren

The current error is really strange. The check in the code looks like this: https://github.com/dotnet/runtime/blob/59bb74c9ecc743a35ef5401f5b2baf2f44e986f2/src/coreclr/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test2/test2.cpp#L57-L65

From the message above, the values of the variables were: ChildThreadWaitTime = 1000 InterruptTime = 500 ThreadWaitDelta_WFMO_test2 = 499

The TOLERANCE is defined as 10. So the condition with replaced variables by values looks like

((499 >= 1000) && (499 - 1000) > 10)
|| (( 499 < 500) && (499 - 500) > 10)

So this condition should have been evaluated as false and the error message should not have been printed.

That means that there is likely a write visibility problem (the ThreadWaitDelta_WFMO_test2 is set by a secondary thread, but read on the main thread) or the compiler moved reading the ThreadWaitDelta_WFMO_test2 to some point before the secondary thread completed.

janvorli avatar Oct 09 '20 15:10 janvorli

Actually, I've checked the types of the three variables and they are all unsigned! So 499-500 is not -1, but 0xffffffff, which is obviously > 10. That explains why the test goes the failure path. And I've also realized that the second part of the condition is wrong, it first tests if the ThreadWaitDelta_WFMO_test2 is less than the InterruptTime and then checks if the ThreadWaitDelta_WFMO_test2 - InterruptTime, which would always be <= 0, is larger than the TOLERANCE. So it is a test bug. The subtraction should be reversed. The test should pass as the 1ms delta is within the tolerance.

janvorli avatar Oct 12 '20 10:10 janvorli