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

ASF GitHub Bot commented on FLINK-5830:
---------------------------------------

Github user StephanEwen commented on the issue:

    https://github.com/apache/flink/pull/3360
  
    I would suggest that we adopt the following pattern for all the places like 
the one in this pull request where we catch Throwables:
    
    ```java
    try {
        ...
    } catch (Throwable t) {
        ExceptionUtils.rethrowIfFatalErrorOrOOM(t);
    
         // the other handling logic...
    }
    ```
    
    This requires to add the function `rethrowIfFatalErrorOrOOM(Throwable)` to 
the `ExceptionUtils`, similar to the method here: 
https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L109
    
    It would be even nicer if we could do something like Scala supports, but I 
think there is no way better way to do this in Java than the way suggested above
    ```scala
    try {
        ...
    } catch {
        case NonFatal(t) => // does not include OOM and internal errors
    ```


> OutOfMemoryError during notify final state in TaskExecutor may cause job stuck
> ------------------------------------------------------------------------------
>
>                 Key: FLINK-5830
>                 URL: https://issues.apache.org/jira/browse/FLINK-5830
>             Project: Flink
>          Issue Type: Bug
>            Reporter: zhijiang
>            Assignee: zhijiang
>
> The scenario is like this:
> {{JobMaster}} tries to cancel all the executions when process failed 
> execution, and the task executor already acknowledge the cancel rpc message.
> When notify the final state in {{TaskExecutor}}, it causes OOM in 
> {{AkkaRpcActor}} and this error is caught to log the info. The final state 
> will not be sent any more.
> The {{JobMaster}} can not receive the final state and trigger the restart 
> strategy.
> One solution is to catch the {{OutOfMemoryError}} and throw it, then it will 
> cause to shut down the {{ActorSystem}} resulting in exiting the 
> {{TaskExecutor}}. The {{JobMaster}} can be notified of {{TaskExecutor}} 
> failure and fail all the tasks to trigger restart successfully.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to