You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by lunchbox <lu...@gmail.com> on 2011/07/21 10:17:19 UTC

Possible memory leak in Camel

Hi,

I had an earlier case where I was constantly starting and stopping two
routes (while one is active, the other is not) twice a minute (this was a
house-keeping background task scheduled with Quartz).

My system would run out of memory after several hours. Then I switched to
using suspend/resume and voilĂ ! the problem went away.

I'm not sure if this is related or not, but when I simply used resume (even
when the route was stopped), one of the routes would appear to start (all
the normal log output) but it did not actually do its work. Then, I started
checking the route ServiceStatus and either resuming or starting as needed,
and the routes worked correctly.

I know posting POC code might help but I'm really not sure where exactly the
problem lies. So, Camel team, please consider this as a heads-up there might
be some memory allocation problems associated with starting/stopping a
route.

Thanks,
Lunchbox

--
View this message in context: http://camel.465427.n5.nabble.com/Possible-memory-leak-in-Camel-tp4618516p4618516.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Possible memory leak in Camel

Posted by lunchbox <lu...@gmail.com>.
Hi Claus,

Yeah I am using suspend/resume now. It's the right approach for my use case.

The routes have each a JMS endpoint (ActiveMQ), they are transactional, and
one has an exception handler and also uses a web service (using spring-ws).

Slightly simplified:

from(jmsQueue1)
  .noAutoStartup()
  .onException(Exception.class)
    .to(jmsQueue2).continued(true)
  .end()
  .transacted()
  .to(webService);

from(jmsQueue2)
  .noAutoStartup()
  .transacted()
  .to(jmsQueue1); // there is no "infinite loop" here since only one of
these routes is active at a time

In any case, the difference between running out of memory and not is in
using start/stop vs resume/suspend. And yes, the memory leak could be in
ActiveMQ too (or somewhere) so nothing too definite.

Just posted my discovery as a friendly heads-up in case you have the time to
go over the code at some point keeping this in mind :)

Thanks,
Lunchbox

--
View this message in context: http://camel.465427.n5.nabble.com/Possible-memory-leak-in-Camel-tp4618516p4619058.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Possible memory leak in Camel

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What endpoints are you using in your routes? Maybe you can post your routes?

Also it may not be Camel having an issue, it could be 3rd party
frameworks having a leak as well, as they may not be well designed for
continuously stopping/starting cycles.

Prefer to use suspend/resume as its more "gentle"

On Thu, Jul 21, 2011 at 10:17 AM, lunchbox <lu...@gmail.com> wrote:
> Hi,
>
> I had an earlier case where I was constantly starting and stopping two
> routes (while one is active, the other is not) twice a minute (this was a
> house-keeping background task scheduled with Quartz).
>
> My system would run out of memory after several hours. Then I switched to
> using suspend/resume and voilĂ ! the problem went away.
>
> I'm not sure if this is related or not, but when I simply used resume (even
> when the route was stopped), one of the routes would appear to start (all
> the normal log output) but it did not actually do its work. Then, I started
> checking the route ServiceStatus and either resuming or starting as needed,
> and the routes worked correctly.
>
> I know posting POC code might help but I'm really not sure where exactly the
> problem lies. So, Camel team, please consider this as a heads-up there might
> be some memory allocation problems associated with starting/stopping a
> route.
>
> Thanks,
> Lunchbox
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Possible-memory-leak-in-Camel-tp4618516p4618516.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/