Skip to content

HDFS-17957. Shut down leaked mini-cluster instances and review timeout values in hadoop-hdfs-project tests. - #8659

Open
joseluisll wants to merge 3 commits into
apache:trunkfrom
joseluisll:HDFS-17957-cluster-leak
Open

HDFS-17957. Shut down leaked mini-cluster instances and review timeout values in hadoop-hdfs-project tests.#8659
joseluisll wants to merge 3 commits into
apache:trunkfrom
joseluisll:HDFS-17957-cluster-leak

Conversation

@joseluisll

@joseluisll joseluisll commented Aug 4, 2026

Copy link
Copy Markdown

Description of PR

Shuts down 67 leaked mini-cluster instances across 42 test files in
hadoop-hdfs-project, fixes an assertion race in TestFsVolumeList, and corrects
mis-calibrated test timeout budgets.

A leaked cluster holds NameNode and DataNode threads, heap and ports open for
the rest of the class, so one real failure produces several bogus ones. The 67
cases are: never shut down (22), shut down only on the happy path so the leak
happens exactly when the test fails (36), and held in a field with no teardown
(9). The fixes are try-with-resources, shutdown() in finally, or
@AfterEach.

TestFsVolumeList needed a second, unrelated fix.
testAddRplicaProcessorForAddingReplicaInMap compares the configured pool size
against BlockPoolSlice#getAddReplicaForkPoolSize(), which returned
ForkJoinPool#getPoolSize() — threads started so far, which the pool grows
lazily. That is the expected: <5> but was: <4> failure. The
@VisibleForTesting getter now returns getParallelism(). This is the only
src/main change and the method has no production callers.

TestNNWithQJM#testNewNamenodeTakesOverWriter gets a tolerant shutdown. 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" — which is why the shutdown was commented out.
It now runs inside a try/catch that tolerates that, so the rest of the class
no longer runs under a live fenced NameNode.

TestFetchImage stays as trunk has it. Same fenced-shutdown problem, but it
has a single @Test, so teardown protects nothing and only breaks a class that
passes today.

Timeouts. Four @Timeout values were written in milliseconds as if seconds:
30000, 30000, 300000 and 100000 become 30, 30, 300 and 100. Three
budgets were shorter than the waits they wrap — TestBalancerWithHANameNodes
×2 and TestStandbyCheckpoints#testCheckpointCancellationDuringUpload, 60s →
300s. TestBlockRecoveryCauseStandbyNameNodeCrash moves off fixed ports
50070-73 onto ephemeral ones. Both poms gain
junit.jupiter.execution.timeout.default: 600s for hadoop-hdfs, 1800s for
hadoop-hdfs-rbf, whose fork budget is 3600s because its methods legitimately run
long. The default is additive — a hang in a method with no explicit @Timeout
now fails as a named per-method timeout instead of a surefire fork kill that
discards the whole class's results, and existing @Timeout values are
unchanged.

The remaining survey candidates are in the JIRA: 4 need no fix by design, 4 were
scan false positives, 11 are outside hadoop-hdfs-project.

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:

Module Classes Tests Result
hadoop-hdfs 36 367 green
hadoop-hdfs-rbf 4 22 green
hadoop-hdfs-nfs 1 1 green

For code changes:

  • Does the title of this PR start with the corresponding JIRA issue id?
  • Object storage: N/A
  • If adding new dependencies … — no new dependencies
  • If applicable, have you updated the LICENSE… — N/A

AI Tooling

Contains content generated by Claude Code.

… 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>

@shfshihuafeng shfshihuafeng left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I accidentally approved this PR by mistake.

@joseluisll

Copy link
Copy Markdown
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.🏗

@github-actions github-actions Bot added the build label Aug 6, 2026
@joseluisll joseluisll changed the title HDFS-17957. Shut down leaked mini-cluster instances in hadoop-hdfs-project tests. HDFS-17957. Shut down leaked mini-cluster instances and review timeout values in hadoop-hdfs-project tests. Aug 6, 2026
@joseluisll
joseluisll marked this pull request as ready for review August 6, 2026 14:28
@joseluisll
joseluisll force-pushed the HDFS-17957-cluster-leak branch from a33994e to 8722fba Compare August 6, 2026 17:13
@hadoop-yetus

Copy link
Copy Markdown

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 53s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+0 🆗 xmllint 0m 0s xmllint was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 48 new or modified test files.
_ trunk Compile Tests _
+0 🆗 mvndep 2m 26s Maven dependency ordering for branch
+1 💚 mvninstall 54m 7s trunk passed
+1 💚 compile 6m 6s trunk passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 compile 6m 29s trunk passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 checkstyle 2m 19s trunk passed
+1 💚 mvnsite 4m 27s trunk passed
+1 💚 javadoc 3m 20s trunk passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javadoc 3m 20s trunk passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 spotbugs 8m 7s trunk passed
+1 💚 shadedclient 36m 4s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+0 🆗 mvndep 0m 29s Maven dependency ordering for patch
+1 💚 mvninstall 2m 54s the patch passed
+1 💚 compile 5m 33s the patch passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javac 5m 32s the patch passed
+1 💚 compile 6m 2s the patch passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 javac 6m 2s the patch passed
-1 ❌ blanks 0m 0s /blanks-eol.txt The patch has 5 line(s) that end in blanks. Use git apply --whitespace=fix <<patch_file>>. Refer https://git-scm.com/docs/git-apply
-0 ⚠️ checkstyle 1m 48s /results-checkstyle-hadoop-hdfs-project.txt hadoop-hdfs-project: The patch generated 115 new + 414 unchanged - 116 fixed = 529 total (was 530)
+1 💚 mvnsite 3m 8s the patch passed
+1 💚 javadoc 1m 56s the patch passed with JDK Ubuntu-21.0.11+10-1-24.04.2-Ubuntu
+1 💚 javadoc 2m 0s the patch passed with JDK Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
+1 💚 spotbugs 7m 17s the patch passed
+1 💚 shadedclient 35m 52s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 258m 44s hadoop-hdfs in the patch passed.
+1 💚 unit 3m 39s hadoop-hdfs-nfs in the patch passed.
+1 💚 unit 49m 1s hadoop-hdfs-rbf in the patch passed.
+1 💚 asflicense 0m 52s The patch does not generate ASF License warnings.
509m 8s
Subsystem Report/Notes
Docker ClientAPI=1.55 ServerAPI=1.55 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8659/3/artifact/out/Dockerfile
GITHUB PR #8659
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets xmllint
uname Linux 30fc3cbeb849 5.15.0-181-generic #191-Ubuntu SMP Fri May 22 19:09:02 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 8722fba
Default Java Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.11+10-1-24.04.2-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.19+10-1-24.04.2-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8659/3/testReport/
Max. process+thread count 4556 (vs. ulimit of 10000)
modules C: hadoop-hdfs-project/hadoop-hdfs hadoop-hdfs-project/hadoop-hdfs-nfs hadoop-hdfs-project/hadoop-hdfs-rbf U: hadoop-hdfs-project
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8659/3/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@pan3793
pan3793 requested review from Hexiaoqiao and removed request for shfshihuafeng August 7, 2026 02:31
joseluisll and others added 2 commits August 7, 2026 05:26
…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>
Four mis-calibrated timeout budgets, and a per-method timeout default
for hadoop-hdfs (600s) and hadoop-hdfs-rbf (1800s). Test-only.

Contains content generated by Claude Code.
Generated-by: Claude Code (Opus 5)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@joseluisll
joseluisll force-pushed the HDFS-17957-cluster-leak branch from 8722fba to a0f999d Compare August 7, 2026 05:26
@Hexiaoqiao

Copy link
Copy Markdown
Contributor

Thanks to involve me here. It's really a big PR, I need time to review it, the good news is most of them are test classes which will not bring any harm to core logic. I will finish to review till next Friday. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants