joseluisll opened a new pull request, #8745:
URL: https://github.com/apache/hbase/pull/8745

   JIRA: https://issues.apache.org/jira/browse/HBASE-30466
   
   ### Problem
   
   On https://github.com/apache/hbase/pull/8743 (`large-wave-3`, run 
37489619216), `TestSyncReplicationStandbyKillMaster` failed three times in a 
row:
   
   1. **Run 1**: a real flake in the test body. That one is tracked separately 
in HBASE-30344 / https://github.com/apache/hbase/pull/8578, which only changes 
the test body.
   2. **Rerun 1**: failed in `setUp` because `UTIL1.startMiniCluster()` threw 
`IOException: Shutting down` (the master was not initialised within 200 s). The 
teardown then skipped `shutdownMiniCluster()` because of an `if 
(util.getHBaseCluster() == null) return;` guard. That is the exact state a 
failed `startMiniCluster()` leaves behind: DFS still up and the util still 
marked as running.
   3. **Rerun 2**: failed immediately with `IllegalStateException: A 
mini-cluster is already running`. The log shows the leaked master still writing 
to the leaked DFS.
   
   Surefire reruns happen in the same JVM, so the static `HBaseTestingUtil` 
fields survive from one attempt to the next. One failed start therefore makes 
every later rerun fail too. HBASE-30053 shows the same rerun cascade in another 
test.
   
   While auditing this, I found three more tests that never shut down their 
mini clusters. Each one declares its own static `@AfterAll 
tearDownAfterClass()`, which hides the base class method of the same name, and 
JUnit 5 does not run hidden lifecycle methods.
   
   ### Changes
   
   - `replication/SyncReplicationTestBaseNoBeforeAll`: `shutdown(util)` now 
always calls `util.shutdownMiniCluster()` in a `finally` block, and the 
null-HBase-cluster early return is removed. `tearDown()` chains UTIL1 -> UTIL2 
-> ZK_UTIL through nested `finally` blocks, so a failure on one cluster cannot 
skip the others.
   - `replication/TestClaimReplicationQueue`: `tearDownAfterClass()` now calls 
`TestReplicationBaseNoBeforeAll.tearDownAfterClass()` in `finally`. Before, 
both mini clusters were never shut down.
   - `replication/TestRemovePeerProcedureWaitForSCP`: same fix as 
`TestClaimReplicationQueue`.
   - `regionserver/wal/TestAsyncWALReplay`: `tearDownAfterClass()` now calls 
`AbstractTestWALReplay.tearDownAfterClass()` in `finally`. This also covers its 
3 subclasses.
   
   ### Testing
   
   ```
   mvn -B -pl hbase-server test 
-Dtest='TestSyncReplicationStandbyKillMaster,TestClaimReplicationQueue,TestRemovePeerProcedureWaitForSCP,TestAsyncWALReplay'
 -Dsurefire.failIfNoSpecifiedTests=false
   ```
   
   15 tests ran with 0 failures. The surefire logs now show the class-level 
`Shutting down minicluster` / `Minicluster is down` messages, which were 
missing before for the hidden-teardown classes.
   
   This is a test-only change with no production code touched. The other 
mini-cluster leaks found during the audit will go in separate JIRAs.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to