[
https://issues.apache.org/jira/browse/MAPREDUCE-7542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18104311#comment-18104311
]
ASF GitHub Bot commented on MAPREDUCE-7542:
-------------------------------------------
joseluisll opened a new pull request, #8680:
URL: https://github.com/apache/hadoop/pull/8680
### Description of PR
Shuts down 2 leaked mini-cluster instances in 2
hadoop-mapreduce-client-jobclient test files, the hadoop-mapreduce slice
of the mini-cluster leak scan recorded in HDFS-17957.
A leaked cluster keeps NameNode/DataNode (or ResourceManager/NodeManager)
threads, heap and ports alive under the remaining tests of the class, so
one real failure can cascade into bogus failures of later tests in the
same class.
**`TestNNBench`.** `testNNBenchCrossCluster` shut its `MiniDFSCluster`
down only after the last assertion, so the cluster leaked exactly when
the test failed. The method body now runs under `try`/`finally` and the
shutdown covers every exit.
**`TestDelegationToken`.** The `MiniMRCluster` lives in a field that
`@BeforeEach` rebuilds for every test method, with no teardown in the
class or its ancestors. The class is currently `@Disabled` at class
level, so the leak bites only when the class is re-enabled; the new
`@AfterEach` shuts down whatever `setup()` built and makes re-enabling
safe.
Test-scope only; no production code is touched.
### How was this patch tested?
The touched classes were 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 | Class | Tests | Result |
|---|---|---|---|
| hadoop-mapreduce-client-jobclient | TestNNBench | 4 | all pass (27s) |
| hadoop-mapreduce-client-jobclient | TestDelegationToken | 1 | skipped —
class is `@Disabled`; change verified by test-compile |
### For code changes:
- [x] Does the title of this PR start with the corresponding JIRA issue id
(e.g. 'HADOOP-17799. Your PR title ...')?
- [ ] Object storage: Have the integration tests been executed and the
endpoint
declared according to the connector-specific documentation? *Note:
Automated CI
testing doesn't cover all cases so manual testing with cloud storage
is still
required.*
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`,
`NOTICE-binary` files?
### AI Tooling
Contains content generated by Claude Code.
- [x] The PR includes the phrase "Contains content generated by Claude Code"
- [x] My use of AI contributions follows the ASF legal policy
https://www.apache.org/legal/generative-tooling.html
> Shut down leaked mini-cluster instances
> ---------------------------------------
>
> Key: MAPREDUCE-7542
> URL: https://issues.apache.org/jira/browse/MAPREDUCE-7542
> Project: Hadoop Map/Reduce
> Issue Type: Test
> Components: test
> Reporter: Jose Luis López
> Priority: Minor
> Original Estimate: 8h
> Remaining Estimate: 8h
>
> Part of the mini-cluster leak scan recorded in HDFS-17957, I came across with
> two leaks in the MAPREDUCE project:
>
> * TestNNBench#testNNBenchCrossCluster shuts its dfsCluster down only on the
> happy path, so the cluster leaks exactly when the test fails.
> * TestDelegationToken holds a cluster in a field with no teardown in the class
> or its ancestors.
>
> Impact: a leaked cluster keeps threads, heap and ports alive under the
> remaining tests of the class, and a failure on the happy-path-only pattern can
> cascade into bogus failures of later tests in the same class.
>
> The fixes are mechanical - shutdown in a finally block, and a teardown method.
>
> Test-scope only; no production code is touched.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]