Yang Chen created HBASE-26217:
---------------------------------

             Summary: Clean shared state pollution to avoid flaky tests.
                 Key: HBASE-26217
                 URL: https://issues.apache.org/jira/browse/HBASE-26217
             Project: HBase
          Issue Type: Bug
          Components: test
            Reporter: Yang Chen


h4. PR Link:[https://github.com/apache/hbase/pull/3615] 
h2. What is the purpose of this change
 * This PR cleans the state polluted by 
{{org.apache.hadoop.hbase.monitoring.TestTaskMonitor.testDoNotPurgeRPCTask}}.

 * It may be better to clean state pollutions so that some other tests won't 
fail in the future due to the shared state pollution.

h2. Reproduce the test failure
 * Run the test twice in the same JVM.

h2. Expected result:
 * The tests should run successfully when multiple tests that use this state 
are run in the same JVM.

h2. Actual result:
 * We get the failure:
{{[ERROR] Failures: [ERROR] testDoNotPurgeRPCTask:144 RPC Tasks have been 
purged! expected:<10> but was:<20>}}

h2. Why the test fails
 * Each time this test runs,10 RPCtasks are created and added to the ArrayList 
{{rpcTasks}}, but {{rpcTasks}} is not completely purged when the test ends. So 
next time the test starts, the remaining RPC tasks lead to an assertion failure.

h2. Fix
 * Clean all tasks when the test ends.
 * Another solution is to create a new {{TaskMonitor}} each time to avoid 
pollution similar to the other tests (e.g., {{testTaskMonitorBasics}}, 
{{testTasksGetAbortedOnLeak}}) in {{TestTaskMonitor}}. [Create a new 
TaskMonitor each time to avoid flaky tests. 
LALAYANG/hbase#1|https://github.com/LALAYANG/hbase/pull/1]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to