[
https://issues.apache.org/jira/browse/HADOOP-19267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18102258#comment-18102258
]
ASF GitHub Bot commented on HADOOP-19267:
-----------------------------------------
arhxam opened a new pull request, #8661:
URL: https://github.com/apache/hadoop/pull/8661
### Description of PR
Fixes [HADOOP-19267](https://issues.apache.org/jira/browse/HADOOP-19267).
`ShutdownHookManager#getShutdownTimeout` already clamps
`hadoop.service.shutdown.timeout` to its one-second minimum, but it does so
silently. A mistyped or incorrectly converted duration is therefore hard for an
operator to diagnose.
This patch emits a structured warning that identifies the configuration key,
its value after conversion to seconds, the supported minimum, and the value
Hadoop will use. The existing fallback behavior is unchanged.
### How was this patch tested?
On macOS with OpenJDK 17.0.20 and Maven Wrapper 3.9.15:
```text
./mvnw -pl hadoop-common-project/hadoop-common -am -DskipShade \
-Dtest=TestShutdownHookManager \
-Dsurefire.failIfNoSpecifiedTests=false test
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS
```
The updated bad-configuration test captures the class logger and verifies
both the clamped return value and the full diagnostic warning. Before the
production change, the new log assertion fails.
### For code changes:
- [x] 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`, `LICENSE-binary`,
`NOTICE-binary` files? N/A
### AI Tooling
Contains content generated by Codex.
- [x] The PR includes the phrase "Contains content generated by Codex"
- [x] My use of AI contributions follows the ASF legal policy
https://www.apache.org/legal/generative-tooling.html
> Logging Enhancement for Shutdown Timeout Configuration in ShutdownHookManager
> -----------------------------------------------------------------------------
>
> Key: HADOOP-19267
> URL: https://issues.apache.org/jira/browse/HADOOP-19267
> Project: Hadoop Common
> Issue Type: Improvement
> Components: common
> Affects Versions: 3.3.6
> Environment: Hadoop Version: {{`3.3.6`}}
> Location:
> {{{}`hadoop/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/ShutdownHookManager.java`{}}},in
> {{`getShutdownTimeout`}} method. Lines 187-189.
> Reporter: LoggingResearch
> Priority: Major
> Attachments: TestShutdownHookManager.java, original-vs-log-enhanced.md
>
>
> The issue was encountered in scenarios where Hadoop services are expected to
> shut down gracefully within a specified time frame. Misconfigured shutdown
> timeouts can lead to abrupt terminations or extended shutdown periods. The
> original code does not provide sufficient visibility into misconfigurations
> related to the shutdown timeout duration, which can result in unexpected
> behavior during service shutdowns.
>
> *Expected Behavior:*
> The system should log a warning message when the configured shutdown timeout
> is less than the minimum allowed value, and it should reset the duration to
> this minimum value. Additionally, the user should be informed to set the
> {{hadoop.service.shutdown.timeout}} configuration parameter to a valid value.
>
> *How-to-Fix:*
> Enhance the {{getShutdownTimeout}} method by adding logging statements that
> warn when the shutdown timeout is below the allowed minimum, and reset it to
> the minimum value. This logging will help users identify and correct
> misconfigurations.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]