camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Infinite recursion of exceptions. Is it a bug?
Date Wed, 10 May 2017 09:02:15 GMT
Hi

Yeah so the infinite recursion is surely a bug. However its only
triggered when you

- use global onException
- call a direct route from the onException
- causes a 2nd exception

When using route scoped onException this does not happen as the error
handler works a little bit different when its route scoped vs global
scoped. In route scope the FatalFallbackErrorHandler weighs in and
detect the 2nd exception and prevents the recursion.

I have an improved patch in the works based on your commits. Also I am
making sure the two exceptions are not lost, so you have that
information in the stacktrace being logged, and in the right order
(new -> old).



On Tue, May 9, 2017 at 12:57 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> Hi
>
> I ought to have cleared up some room for me to have time tomorrow
> morning to take a look. This sort of thing requires a "calm period"
> where you are not disturbed.
>
>
>
> On Mon, May 8, 2017 at 2:37 PM, Christian Schneider
> <chris@die-schneider.net> wrote:
>> Hi Claus,
>>
>> that is fine. I was hoping for you to take look.
>>
>> Christian
>>
>>
>> On 08.05.2017 14:30, Claus Ibsen wrote:
>>>
>>> On Mon, May 8, 2017 at 1:57 PM, Christian Schneider
>>> <chris@die-schneider.net> wrote:
>>>>
>>>> Hi Zoran,
>>>>
>>>> I have merged your improvements into the branch.
>>>>
>>>> I will wait one more day for feedback and then merge into master.
>>>>
>>> Can you wait some longer. Some of us have been traveling all last week
>>> and are back in our office with jet-lag and a ton of email to catch
>>> up.
>>>
>>> I will take a look at this later this week.
>>>
>>>
>>>
>>>> Christian
>>>>
>>>>
>>>> On 08.05.2017 11:57, Zoran Regvart wrote:
>>>>>
>>>>> Hi Christian,
>>>>> I think that your initial example of the recursion is a simpler
>>>>> example for the unit test, so with that and a minor reformat of the
>>>>> source code I've committed this to my GitHub fork:
>>>>>
>>>>>
>>>>>
>>>>> https://github.com/zregvart/camel/commit/d76f75ea46b55b16af9e0ae05bfbb3df271545bd
>>>>>
>>>>> have a look, thanks :)
>>>>>
>>>>> zoran
>>>>>
>>>>> On Fri, May 5, 2017 at 5:43 PM, Christian Schneider
>>>>> <chris@die-schneider.net> wrote:
>>>>>>
>>>>>> I have pushed a test and a possible fix to
>>>>>> https://github.com/apache/camel/tree/CAMEL-11229
>>>>>>
>>>>>> As the code around error handling is pretty difficult to understand
I
>>>>>> am
>>>>>> not
>>>>>> sure if my solution is good. I would be happy if someone could review
>>>>>> my
>>>>>> change.
>>>>>>
>>>>>> Christian
>>>>>>
>>>>>>
>>>>>> On 04.05.2017 17:30, Christian Schneider wrote:
>>>>>>>
>>>>>>> I have the routes below. When I send a message to direct:test
I get an
>>>>>>> infinite recursion of exceptions.
>>>>>>> The reason is that the onException handler also seems to be called
for
>>>>>>> the
>>>>>>> direct:handle_er that is called when handling the
>>>>>>> first exception. In case such a handler route also throws an
exception
>>>>>>> the
>>>>>>> recursion happens.
>>>>>>>
>>>>>>> Is this expected or a bug?
>>>>>>> If it is not a bug what do we recommend our users to avoid the
>>>>>>> recursion?
>>>>>>>
>>>>>>>                   onException(Throwable.class)
>>>>>>>                   .to("direct:handle_er");
>>>>>>>
>>>>>>>                   from("direct:test")
>>>>>>>                   .throwException(new RuntimeException())
>>>>>>>                   .to("log:test2");
>>>>>>>
>>>>>>>                   from("direct:handle_er")
>>>>>>>                   .throwException(new RuntimeException());
>>>>>>>
>>>>>>> See also https://issues.apache.org/jira/browse/CAMEL-11229
>>>>>>>
>>>>>>> Christian
>>>>>>>
>>>>>> --
>>>>>> Christian Schneider
>>>>>> http://www.liquid-reality.de
>>>>>>
>>>>>> Open Source Architect
>>>>>> http://www.talend.com
>>>>>>
>>>>>
>>>>
>>>> --
>>>> Christian Schneider
>>>> http://www.liquid-reality.de
>>>>
>>>> Open Source Architect
>>>> http://www.talend.com
>>>>
>>>
>>>
>>
>>
>> --
>> Christian Schneider
>> http://www.liquid-reality.de
>>
>> Open Source Architect
>> http://www.talend.com
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Mime
View raw message