HDFS-17957. Shut down leaked mini-cluster instances in hadoop-hdfs-project tests. - #8659
Draft
joseluisll wants to merge 2 commits into
Draft
HDFS-17957. Shut down leaked mini-cluster instances in hadoop-hdfs-project tests.#8659joseluisll wants to merge 2 commits into
joseluisll wants to merge 2 commits into
Conversation
… race in TestFsVolumeList. getAddReplicaForkPoolSize() now returns getParallelism() instead of the lazily grown getPoolSize(). It is @VisibleForTesting with no production callers. Contains content generated by Claude Code. Generated-by: Claude Code (Opus 5) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…oject tests. 65 cases in 41 files: hadoop-hdfs (36), hadoop-hdfs-rbf (4), hadoop-hdfs-nfs (1). Test-only. Contains content generated by Claude Code. Generated-by: Claude Code (Opus 5) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
shfshihuafeng
approved these changes
Aug 5, 2026
shfshihuafeng
suggested changes
Aug 5, 2026
shfshihuafeng
left a comment
There was a problem hiding this comment.
I accidentally approved this PR by mistake.
Author
|
It is almost finished. I left in draft because I would like to give it a second review before putting it as ready and get back to you.🏗 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of PR
Shuts down 67 leaked mini-cluster instances across 42 test files in
hadoop-hdfs-project, and fixes an assertion race in
TestFsVolumeList.A leaked cluster keeps its NameNode and DataNode threads, heap and ports alive
under the remaining tests of the class, so one real failure turns into several
bogus ones. The three categories are cluster never shut down (22), shut down
only on the happy path so it leaks precisely when the test fails (36), and held
in a field with no teardown (9). The fixes are
try-with-resources,shutdown()moved into
finally, or an@AfterEach.Two things a reviewer should look at:
TestFsVolumeListalso gets an unrelated fix, without which it stays red. ItstestAddRplicaProcessorForAddingReplicaInMapcompares the configured pool sizeagainst
BlockPoolSlice#getAddReplicaForkPoolSize(), which returnedForkJoinPool#getPoolSize()— threads currently started, which the pool growslazily — giving its
expected: <5> but was: <4>failures. The@VisibleForTestinggetter now returnsgetParallelism(). This is the onlysrc/mainchange in the PR and the method has no production callers.TestNNWithQJM#testNewNamenodeTakesOverWriterhad its shutdown commented outon purpose: the test leaves its NameNode fenced behind a second cluster holding
the journal quorum, so closing the edit log terminates the JVM with "Could not
sync enough journals to persistent storage". It is now shut down inside a
try/catchthat tolerates that, so the rest of the class no longer runsunderneath a live fenced NameNode. This is the only judgement call in the diff.
TestFetchImageis the one survey case deliberately left alone — same fencedshutdown problem, but with a single
@Testthere is no later test to protect,so adding teardown would only break a class that passes today.
The remaining survey candidates are itemised in the JIRA: 4 need no fix by
design, 4 were scan false positives, and 11 are outside hadoop-hdfs-project and
tracked separately.
How was this patch tested?
Every touched test class was run on Ubuntu 24.04 with JDK
17.0.19+10-1-24.04.2-Ubuntu, the same JDK and OS as the precommit agents:For code changes:
LICENSE… — N/AAI Tooling
Contains content generated by Claude Code.
https://www.apache.org/legal/generative-tooling.html