joseluisll opened a new pull request, #8836: URL: https://github.com/apache/hadoop/pull/8836
### Description of PR JIRA: https://issues.apache.org/jira/browse/YARN-12028 `DelegationTokenRenewer.DelegationTokenCancelThread.run()` called `System.exit(-1)` when cancelling a token threw anything other than an `IOException`, `RuntimeException` or `InterruptedException`. In practice that is an `Error`: `UserGroupInformation.doAs()` wraps other checked exceptions in a `RuntimeException`. Exiting is intentional (YARN-690), but calling `System.exit` directly bypasses `ExitUtil`. Tests that call `ExitUtil.disableSystemExit()` cannot intercept it, so an `Error` raised while cancelling a token in a test kills the surefire fork and the original failure is lost. Changes: - Call `ExitUtil.terminate(-1, t)` instead of `System.exit(-1)`. Production behaviour is unchanged: with exits enabled, `ExitUtil.terminate` ends in `System.exit(-1)`. - Log the throwable at ERROR, not WARN, since it terminates the RM. - Add `TestDelegationTokenRenewer#testTokenCancelErrorTerminates`. It makes the test `Renewer.cancel()` throw an `AssertionError`, finishes an application whose token is cancelled at the end, and checks for an `ExitException` with exit code -1 and the original `AssertionError` as its cause. Related: HADOOP-20010 (same issue in `AbstractDelegationTokenSecretManager.ExpiredTokenRemover`) and HADOOP-20022 (same issue in `SecurityUtil.doAsLoginUserOrFatal`). ### How was this patch tested? - `mvn test -Dtest=TestDelegationTokenRenewer -Dmaven.test.failure.ignore=false` in `hadoop-yarn-server-resourcemanager` on Ubuntu 24.04 (WSL2), OpenJDK 17, Maven 3.9.16: 24 tests run, 0 failures, 0 errors. - The new test run against the original code kills the surefire fork ("The forked VM terminated without properly saying goodbye. VM crash or System.exit called?"), so it reproduces the problem. - Checkstyle: no violations on the changed lines. ### 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? (Not applicable: no object storage changes.) - [ ] 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)? (Not applicable: no new dependencies.) - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, `NOTICE-binary` files? (Not applicable.) ### AI Tooling If an AI tool was used: - [x] The PR includes the phrase "Contains content generated by <tool>" where <tool> is the name of the AI tool used. - [x] My use of AI contributions follows the ASF legal policy https://www.apache.org/legal/generative-tooling.html Contains content generated by Claude Code. 🤖 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
