You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by "Jagadish (JIRA)" <ji...@apache.org> on 2017/02/02 00:50:51 UTC

[jira] [Updated] (SAMZA-1077) SamzaContainer should catch all Throwables instead of only exceptions

     [ https://issues.apache.org/jira/browse/SAMZA-1077?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jagadish updated SAMZA-1077:
----------------------------
    Fix Version/s: 0.12.0

> SamzaContainer should catch all Throwables instead of only exceptions
> ---------------------------------------------------------------------
>
>                 Key: SAMZA-1077
>                 URL: https://issues.apache.org/jira/browse/SAMZA-1077
>             Project: Samza
>          Issue Type: Bug
>            Reporter: Jagadish
>            Assignee: Jagadish
>             Fix For: 0.12.0
>
>
> Here's the snippet from the startup sequence of the SamzaContainer.
> {code:title=SamzaContainer.scala|borderStyle=solid}
>       startProducers
>       startTask
>       startConsumers
>       startSecurityManger
>       info("Entering run loop.")
>       addShutdownHook
>       runLoop.run
>     } catch {
>       case e: Exception =>
>         error("Caught exception in process loop.", e)
>         throw e
>     } finally {
>       info("Shutting down.")
>       shutdownConsumers
>       shutdownTask
>       shutdownStores
> {code}
> In this case, the catch block merely catches Exceptions and not Errors. 
> Consider the following sequence:
> 1. `NoSuchMethodError` thrown in the startup sequence. 
> 2. The error is not caught in the catch block (hence, not logged) and the control reaches the finally block.
> 3. The finally block throws an exception in one of the shutdown methods.
> 4. The thrown exception completely masks the underlying NoSuchMethodError. 
> Catching all Throwables will atleast help log the error. 
> Ideally, finally block should be idempotent and not throw exceptions (but, that's for a different ticket since it's larger in scope)



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