You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by StephanEwen <gi...@git.apache.org> on 2017/02/20 11:22:32 UTC

[GitHub] flink issue #3360: [FLINK-5830][Distributed Coordination] Handle OutOfMemory...

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
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---