Bug 52800 - Please do not catch Throwable!
Summary: Please do not catch Throwable!
Status: RESOLVED DUPLICATE of bug 48644
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.26
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2012-03-01 00:37 UTC by Michael van der Gulik
Modified: 2012-03-01 03:37 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Michael van der Gulik 2012-03-01 00:37:17 UTC
See also bug 48644.

I see "catch (Throwable ..." occurring 311 times in the Tomcat source:

$ grep -r "catch.*(.*Throwable" * | wc -l

Please at the very least, change these to "catch (Exception ...". Otherwise you end up catching OutOfMemoryErrors.

IMHO, and I haven't grepped the mailing list for any controversy surrounding this, when Tomcat (or anything!!!) receives an OOME, it should exit to the OS to be restarted by whatever script or mechanism is managing it. You cannot recover from an OOME, and I have to resort to SIGKILL to stop the JVM.
Comment 1 Michael van der Gulik 2012-03-01 01:36:43 UTC
Most catch clauses seem to use "ExceptionUtils.handleThrowable(t)", which rethrows the Throwable if it is important.

Grumble mumble, nasty way to handle errors, but it does resolve this issue.
Comment 2 Konstantin Kolinko 2012-03-01 03:37:12 UTC
As you correctly noted, this has been fixed a while ago.
I am marking it as duplicate.

*** This bug has been marked as a duplicate of bug 48644 ***