Andrey N. Gura created IGNITE-15941:
---------------------------------------
Summary: Flaky test
FailureProcessorThreadDumpThrottlingTest.testThrottlingPerFailureType
Key: IGNITE-15941
URL: https://issues.apache.org/jira/browse/IGNITE-15941
Project: Ignite
Issue Type: Bug
Reporter: Andrey N. Gura
Assignee: Andrey N. Gura
Fix For: 2.12
The test
{{FailureProcessorThreadDumpThrottlingTest.testThrottlingPerFailureType}} is
flaky. See stack trace:
{noformat}
java.lang.AssertionError
at org.junit.Assert.fail(Assert.java:86)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.junit.Assert.assertTrue(Assert.java:52)
at
org.apache.ignite.testframework.junits.JUnitAssertAware.assertTrue(JUnitAssertAware.java:33)
at
org.apache.ignite.internal.processors.failure.FailureProcessorThreadDumpThrottlingTest.testThrottlingPerFailureType(FailureProcessorThreadDumpThrottlingTest.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.apache.ignite.testframework.junits.GridAbstractTest$7.run(GridAbstractTest.java:2402)
at java.lang.Thread.run(Thread.java:748)
{noformat}
The problem is usage of different sources of time in the test and in a
production code. While the test uses system timer for sleeping
({{Thread.sleep}}) the production code uses timer thread which refreshes a
cached time value periodically ({{IgniteUtils.currentTimeMillis}}). As result
the following situation is possible: the test's thread sleeps some given time
(3000 ms), wakes up and check cached time from timer thread which is still lags
behind the test's thread because timer thread didn't get quantum from thread
scheduler. Such situation breaks invariant and test fails.
This could be fixed in two ways:
1. fix the test in such way when the test's thread waits proper time value from
the timer thread
2. fix production code by changing {{U.currentTimeMillis}} call to
{{System.currentTimeMillis}}.
Because failure processor is not performance critical component the second way
is better the the first way because such solution allows to avoid similar bugs
in other tests.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)