[ 
https://issues.apache.org/jira/browse/YARN-11541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763699#comment-17763699
 ] 

ASF GitHub Bot commented on YARN-11541:
---------------------------------------

teamconfx opened a new pull request, #6050:
URL: https://github.com/apache/hadoop/pull/6050

   ### Description of PR
   https://issues.apache.org/jira/browse/YARN-11541
   This PR adds a positivity check for the parameter 
`yarn.dispatcher.print-events-info.threshold`.
   
   ### How was this patch tested?
   (1) set yarn.dispatcher.print-events-info.threshold=0
   (2) run 
org.apache.hadoop.yarn.event.TestAsyncDispatcher#testDispatcherMetricsHistogram
   The test throws an IllegalArgumentException stating that the configuration 
value should be positive.
   
   ### For code changes:
   
   - [x] Does the title or this PR starts 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?
   - [ ] 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?




> AsyncDispatcher causes ArithmeticException due to improper detailsInterval 
> value checking
> -----------------------------------------------------------------------------------------
>
>                 Key: YARN-11541
>                 URL: https://issues.apache.org/jira/browse/YARN-11541
>             Project: Hadoop YARN
>          Issue Type: Bug
>    Affects Versions: 3.3.3
>            Reporter: ConfX
>            Priority: Critical
>         Attachments: reproduce.sh
>
>
> h2. What happened
> There is no value checking for parameter 
> {{{}yarn.dispatcher.print-events-info.threshold{}}}. This may cause improper 
> calculations and crashes the system like division by 0.
> h2. Buggy code
> In {{{}AsyncDispatcher.java{}}}, there is no value checking for 
> {{detailsInterval}} and this variable is directly used in the event handler. 
> When {{detailsInterval}} is mistakenly set to 0, the code would cause 
> division by 0 and throw ArithmeticException to crash the system.
> {noformat}
>     public void handle(Event event) {
>     . . . 
>       if (qSize != 0 && qSize % detailsInterval == 0                 // 
> detailsInterval gets its value from the aforementioned config param 
>               && lastEventDetailsQueueSizeLogged != qSize) {
>     . . .{noformat}
> h2. How to reproduce
> (1) set yarn.dispatcher.print-events-info.threshold=0
> (2) run 
> org.apache.hadoop.yarn.event.TestAsyncDispatcher#testDispatcherMetricsHistogram
> you should observe the following failure:
> {noformat}
> java.lang.ArithmeticException: / by zero
>     at 
> org.apache.hadoop.yarn.event.AsyncDispatcher$GenericEventHandler.handle(AsyncDispatcher.java:348)
>     at 
> org.apache.hadoop.yarn.event.TestAsyncDispatcher.testDispatcherMetricsHistogram(TestAsyncDispatcher.java:370)
>         ...{noformat}
> For an easy reproduction, run the reproduce.sh in the attachment.
> We are happy to provide a patch if this issue is confirmed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to