Author stefan.richthofer
Recipients jamesmudd, jeff.allen, stefan.richthofer, zyasoft
Date 2017-03-30.09:15:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Okay, with James' hints I was able to write a new minimal example showing how finally blocks can be bypassed ... actually. See

The trick is as follows: After catching a StackOverflowError, the finally block performs a method-call. Even if the called method is empty, this can sometimes directly trigger another StackOverflowError, because the stack is already near to exhaustion. (In the example I let the dummy-method call itself twice so the stack expands slightly more, which makes the issue occur literally always.)

You will find that it outputs something like

continue normal execution... 7924

which means that some resource would not have been successfully cleaned up. (Otherwise it would be "continue normal execution... 0")

I guess that an increased xss somehow lets the JVM manage stack memory in larger blocks, so it is more resilient if the finally block requires additional stack; however this is a pure guess.

The real question is:
Why is the StackOverflowError happening in the finally block (?) not thrown? AFAIK exceptions raised in catch or finally blocks should propagate up the stack, e.g. see

So this behavior is definitely somehow fishy.
Date User Action Args
2017-03-30 09:15:58stefan.richthofersetmessageid: <>
2017-03-30 09:15:58stefan.richthofersetrecipients: + stefan.richthofer, zyasoft, jeff.allen, jamesmudd
2017-03-30 09:15:58stefan.richthoferlinkissue2536 messages
2017-03-30 09:15:57stefan.richthofercreate