Daniella Hubble created IGNITE-23858:
----------------------------------------
Summary: FreeListImplTest#testMultiThread is flaky
Key: IGNITE-23858
URL: https://issues.apache.org/jira/browse/IGNITE-23858
Project: Ignite
Issue Type: Bug
Reporter: Daniella Hubble
The `FreeListImplTest#testMultiThread` test intermittently fails due to
non-deterministic behavior. The issue was identified using
[NonDex|[https://github.com/TestingResearchIllinois/NonDex] ], a tool designed
to detect flaky tests by introducing non-deterministic order in the execution
of methods that rely on unordered collections or concurrency.
To reproduce:
1) Set up NonDex for the project.
2) Run the following command './gradlew :ignite-page-memory:nondexTest
--tests=FreeListImplTest.testMultiThread'
3) Observe the intermittent test failure:
{code:java}
> Task :ignite-page-memory:nondexTestFreeListImplTest > testMultiThread(int,
> boolean) > [1] 1024, true FAILED
java.util.concurrent.TimeoutException at FreeListImplTest.java:116
{code}
The flaky behavior appears to be caused by the nondeterministic nature of
'ConcurrentHashMap'. Since thread execution order can vary, this may lead to
inconsistent states, causing the test to hang or time out.
Fix:
When the 'ConcurrentHashMap' is replaced with a 'ConcurrentSkipListMap', the
test consistently passes in both normal execution (using command: './gradlew
:ignite-page-memory:test --tests=FreeListImplTest.testMultiThread') and under
NonDex testing (using command: './gradlew :ignite-page-memory:nondexTest
--tests=FreeListImplTest.testMultiThread'). This is because
'ConcurrentSkipListMap' maintains a predictable order for elements, reducing
the potential for inconsistent states in concurrent operations.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)