You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sri <sr...@googlemail.com> on 2011/03/18 13:59:31 UTC

catching OutOfMemoryError on the route

Hello,

we are getting OutOfMemoryError at some point of time on the route, but the
application doesn't stop after that. so we tried to catch the Error and
issue System.exit() , but Unfortunately we are unable to catch that error on
.onException(OutOfMemoryError.class). is there any other way that we can
this error and stop the JVM.

Regards
Sri

--
View this message in context: http://camel.465427.n5.nabble.com/catching-OutOfMemoryError-on-the-route-tp3962278p3962278.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: catching OutOfMemoryError on the route

Posted by Taariq Levack <ta...@itaro.co.za>.
I don't know if you've been trying this in the meantime, but have the JVM write a heap dump when it runs out of memory.
Then you can see what's going on, fix it, and not have to try to handle it at all.

Taariq


-----Original Message-----
From: Sri [mailto:sri.tech97@googlemail.com] 
Sent: 18 March 2011 15:00
To: users@camel.apache.org
Subject: catching OutOfMemoryError on the route

Hello,

we are getting OutOfMemoryError at some point of time on the route, but the application doesn't stop after that. so we tried to catch the Error and issue System.exit() , but Unfortunately we are unable to catch that error on .onException(OutOfMemoryError.class). is there any other way that we can this error and stop the JVM.

Regards
Sri

--
View this message in context: http://camel.465427.n5.nabble.com/catching-OutOfMemoryError-on-the-route-tp3962278p3962278.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: catching OutOfMemoryError on the route

Posted by Richard Kettelerij <ri...@gmail.com>.
Catching OutOfMemoryErrors using try/catch isn't the way to go. Like Taariq I
advice monitoring your app and make heap dumps for memory analysis purposes. 

A tip: If you add -XX:+HeapDumpOnOutOfMemoryError as a JVM startup parameter
you can have JVM automatically create a heap dump in the unfortunate case an
OutOfMemoryError occurs. See
http://www.oracle.com/technetwork/java/javase/memleaks-137499.html#gdyrr.

--
View this message in context: http://camel.465427.n5.nabble.com/catching-OutOfMemoryError-on-the-route-tp3962278p3985770.html
Sent from the Camel - Users mailing list archive at Nabble.com.