You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by suman <pr...@gmail.com> on 2011/12/29 18:42:43 UTC

ProducerCache memory leak?

Hello All,
Iam using camel 2.8.3 and have an issue regarding ProducerCache objects not
being garbage collected.
I browsed through this list regarding the same with not much luck.
I dynamically start and stop the route throughout my application and when i
do that it seems like camel retains lot of SendProcessor and ProducerCache
instances(Within camel Spring context).
Is there any solution to this problem?

Many Thanks



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

Re: ProducerCache memory leak?

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jan 5, 2012 at 11:29 AM, suman <pr...@gmail.com> wrote:
> All good now..Thanks for your help
>

Thanks for testing and reporting the issue.


> --
> View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5122306.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/

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
All good now..Thanks for your help

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

Re: ProducerCache memory leak?

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jan 4, 2012 at 4:47 PM, suman <pr...@gmail.com> wrote:
> Thanks for your help.
> Producercache have stopped growing.And i have configured onException() to be
> route specific.
> I will monitor it through the night and see if everything is fine.
> On a different note,when would these fixes make into main
> release/tag?Because currently i have manually checked out the branch and
> built the artifact locally.Is there any way around this?Is there a nexus
> which i can access as it wont be available in maven repo till it makes to
> main release?
>

Apache has a SNAPSHOT maven repo, which gets published usually once per day.

Some details from the download page
http://camel.apache.org/download

Alternatively then some of the Camel support vendors such as
FuseSource offers our own distribution, where we may do releases
in-between Apache. And thus there may be a stable release with the
fix.



> Regards
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5119931.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/

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
Thanks for your help.
Producercache have stopped growing.And i have configured onException() to be
route specific.
I will monitor it through the night and see if everything is fine.
On a different note,when would these fixes make into main
release/tag?Because currently i have manually checked out the branch and
built the artifact locally.Is there any way around this?Is there a nexus
which i can access as it wont be available in maven repo till it makes to
main release?

Regards


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

Re: ProducerCache memory leak?

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jan 4, 2012 at 2:05 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> I found a glitch in the stopping logic when using the onException. I
> will dig a bit to get the producer cache to be removed.
>

Okay I have back ported a fix to the 2.8 branch. Can you try again.
You need to use route scoped onException.

And for the recipient list, you may need to use 2 x end to properly
end the onException from the route itself.



>
> On Wed, Jan 4, 2012 at 12:20 PM, suman <pr...@gmail.com> wrote:
>> Hello,
>> Thanks for quick response.
>> I moved the exception clause to route scope but i get the following
>> exception while starting route.And this is because using recepientlist
>> within that exception handling.
>> ===================================
>>
>>
>> 2012-01-04 11:14:50,612 [                          main]
>> SportsBookRouteBuilder         ERROR Exchange[ExchangePattern:InOnly,
>> BodyType:String, Body:1000693194,
>> CaughtExceptionType:java.lang.UnsupportedOperationException,
>> CaughtExceptionMessage:null,
>> StackTrace:java.lang.UnsupportedOperationException
>>        at java.util.AbstractList.add(AbstractList.java:131)
>>        at java.util.AbstractList.add(AbstractList.java:91)
>>        at
>> org.apache.camel.model.OnExceptionDefinition.onException(OnExceptionDefinition.java:242)
>>        at
>> com.sbpushconversion.dynaroutebuilder.DynamicRouteStarter$1.configure(DynamicRouteStarter.java:45)
>>        at
>> org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:322)
>>        at
>> org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:277)
>>        at
>> org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:263)
>>        at
>> org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:603)
>>        at
>> com.sbpushconversion.dynaroutebuilder.DynamicRouteStarter.startRoute(DynamicRouteStarter.java:30)
>>        at
>> com.sbpushconversion.marcom.processor.KambiLiveEventProcessor.process(KambiLiveEventProcessor.java:32)
>>        at
>> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
>>        at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>>        at
>> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
>>        at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
>>        at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>>        at
>> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
>>        at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
>>        at
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)
>>        at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>>        at
>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)
>>        at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
>>        at
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)
>>        at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:116)
>>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:79)
>>        at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>>        at
>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)
>>        at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
>>        at
>> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)
>>        at
>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)
>>        at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>>        at
>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:572)
>>        at
>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:505)
>>        at
>> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:218)
>>        at org.apache.camel.processor.Splitter.process(Splitter.java:96)
>>        at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>>        at
>> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
>>        at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
>>        at
>> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)
>>        at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>>        at
>> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)
>>        at
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
>>        at
>> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)
>>        at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:116)
>>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:79)
>>        at
>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:111)
>>        at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>>        at
>> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
>>        at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
>>        at
>> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
>>        at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>>        at
>> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)
>>        at
>> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)
>>        at
>> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)
>>        at
>> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:104)
>>        at
>> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
>>        at
>> org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63)
>>        at
>> org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:351)
>>        at
>> org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:323)
>>        at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:222)
>>        at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:323)
>>        at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:168)
>>        at
>> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:110)
>>        at
>> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:123)
>>        at
>> com.sbpushconversion.dynaroutebuilder.SportsBookRouteBootStrapperComponent.onApplicationEvent(SportsBookRouteBootStrapperComponent.java:21)
>>        at
>> com.sbpushconversion.dynaroutebuilder.SportsBookRouteBootStrapperComponent.onApplicationEvent(SportsBookRouteBootStrapperComponent.java:11)
>>        at
>> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
>>        at
>> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
>>        at
>> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
>>        at
>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
>>        at
>> org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:467)
>>        at
>> org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:483)
>>        at
>> org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:358)
>>        at
>> org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:325)
>>        at
>> org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
>>        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
>>        at
>> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
>>        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
>>        at
>> org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4420)
>>        at
>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4733)
>>        at
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
>>        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
>>        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
>>        at
>> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
>>        at
>> org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
>>        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
>>        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
>>        at
>> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
>>        at
>> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
>>        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
>>        at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
>>        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
>>        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
>>        at org.apache.catalina.core.StandardService.start(StandardService.java:525)
>>        at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
>>        at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
>>        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
>>
>> =================================
>> And this is my amended route
>>
>>  fromF("amqp:queue:%s", name)
>>
>>
>> .onException(AddBetOfferEventNotFoundException.class,
>> OddsAddedBetOfferNotFoundException.class,
>> OddsRemovedEventNotFoundException.class,
>> OddsRemovedBetOfferNotFoundException.class,OddsUpdatedBetOfferNotFoundException.class,RemoveBetOfferNotFoundException.class,OpenAllBetOffersEventNotFoundException.class,SuspendAllBetOffersEventNotFoundException.class,UpdateBetOfferStatusEventNotFoundException.class,RemoveBetOfferEventNotFoundException.class,OddsUpdatedEventNotFoundException.class).handled(true)
>>                        .setHeader(Exchange.HTTP_METHOD,
>> constant(org.apache.camel.component.http4.HttpMethods.GET))
>>                        .recipientList(simple(kambiLiveEventUrlForOpenEvent,
>> String.class))
>>                        .setHeader(CacheConstants.CACHE_OPERATION,
>> constant(CacheConstants.CACHE_OPERATION_ADD))
>>                        .setHeader(CacheConstants.CACHE_KEY,
>> header("eventid"))
>>                        .convertBodyTo(String.class, "UTF-8")
>>                        .to("cache://LiveOddsCache").end()
>>
>>
>> .onException(Throwable.class).handled(true).useOriginalMessage().to("log:com.dynaroutebuilder.DynamicRouteStarter?level=ERROR&showException=true&showCaughtException=true&showStackTrace=true").end()
>>
>>
>>                        .setHeader("eventid", constant(eventId))
>>                        .process(protoBufMessageProcessor).routeId(name)
>>                        .choice()
>>
>> .when(header("messagetype").isEqualTo(ProtoMessageType.ADD_EVENT))
>>
>> .marshal(jacksonDataFormatProcessor.getJacksonDataFormat()).process(new
>> AddBetOfferEventUpdateProcessor())
>>                        .setHeader(CacheConstants.CACHE_OPERATION,
>> constant(CacheConstants.CACHE_OPERATION_ADD))
>>                        .setHeader(CacheConstants.CACHE_KEY,
>> header("eventid"))
>>                        .to("log:ADD_EVENT")
>>                        .to("cache://LiveOddsCache")
>>                        .otherwise()
>>                        .to("log:unhandledevent");
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5119339.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/



-- 
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/

Re: ProducerCache memory leak?

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

I found a glitch in the stopping logic when using the onException. I
will dig a bit to get the producer cache to be removed.


On Wed, Jan 4, 2012 at 12:20 PM, suman <pr...@gmail.com> wrote:
> Hello,
> Thanks for quick response.
> I moved the exception clause to route scope but i get the following
> exception while starting route.And this is because using recepientlist
> within that exception handling.
> ===================================
>
>
> 2012-01-04 11:14:50,612 [                          main]
> SportsBookRouteBuilder         ERROR Exchange[ExchangePattern:InOnly,
> BodyType:String, Body:1000693194,
> CaughtExceptionType:java.lang.UnsupportedOperationException,
> CaughtExceptionMessage:null,
> StackTrace:java.lang.UnsupportedOperationException
>        at java.util.AbstractList.add(AbstractList.java:131)
>        at java.util.AbstractList.add(AbstractList.java:91)
>        at
> org.apache.camel.model.OnExceptionDefinition.onException(OnExceptionDefinition.java:242)
>        at
> com.sbpushconversion.dynaroutebuilder.DynamicRouteStarter$1.configure(DynamicRouteStarter.java:45)
>        at
> org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:322)
>        at
> org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:277)
>        at
> org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:263)
>        at
> org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:603)
>        at
> com.sbpushconversion.dynaroutebuilder.DynamicRouteStarter.startRoute(DynamicRouteStarter.java:30)
>        at
> com.sbpushconversion.marcom.processor.KambiLiveEventProcessor.process(KambiLiveEventProcessor.java:32)
>        at
> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
>        at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
>        at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:116)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:79)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>        at
> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:572)
>        at
> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:505)
>        at
> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:218)
>        at org.apache.camel.processor.Splitter.process(Splitter.java:96)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
>        at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)
>        at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
>        at
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:116)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:79)
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:111)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
>        at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
>        at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:104)
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
>        at
> org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63)
>        at
> org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:351)
>        at
> org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:323)
>        at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:222)
>        at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:323)
>        at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:168)
>        at
> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:110)
>        at
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:123)
>        at
> com.sbpushconversion.dynaroutebuilder.SportsBookRouteBootStrapperComponent.onApplicationEvent(SportsBookRouteBootStrapperComponent.java:21)
>        at
> com.sbpushconversion.dynaroutebuilder.SportsBookRouteBootStrapperComponent.onApplicationEvent(SportsBookRouteBootStrapperComponent.java:11)
>        at
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
>        at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
>        at
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
>        at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
>        at
> org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:467)
>        at
> org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:483)
>        at
> org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:358)
>        at
> org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:325)
>        at
> org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
>        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
>        at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
>        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
>        at
> org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4420)
>        at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4733)
>        at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
>        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
>        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
>        at
> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
>        at
> org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
>        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
>        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
>        at
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
>        at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
>        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
>        at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
>        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
>        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
>        at org.apache.catalina.core.StandardService.start(StandardService.java:525)
>        at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
>        at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
>        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
>
> =================================
> And this is my amended route
>
>  fromF("amqp:queue:%s", name)
>
>
> .onException(AddBetOfferEventNotFoundException.class,
> OddsAddedBetOfferNotFoundException.class,
> OddsRemovedEventNotFoundException.class,
> OddsRemovedBetOfferNotFoundException.class,OddsUpdatedBetOfferNotFoundException.class,RemoveBetOfferNotFoundException.class,OpenAllBetOffersEventNotFoundException.class,SuspendAllBetOffersEventNotFoundException.class,UpdateBetOfferStatusEventNotFoundException.class,RemoveBetOfferEventNotFoundException.class,OddsUpdatedEventNotFoundException.class).handled(true)
>                        .setHeader(Exchange.HTTP_METHOD,
> constant(org.apache.camel.component.http4.HttpMethods.GET))
>                        .recipientList(simple(kambiLiveEventUrlForOpenEvent,
> String.class))
>                        .setHeader(CacheConstants.CACHE_OPERATION,
> constant(CacheConstants.CACHE_OPERATION_ADD))
>                        .setHeader(CacheConstants.CACHE_KEY,
> header("eventid"))
>                        .convertBodyTo(String.class, "UTF-8")
>                        .to("cache://LiveOddsCache").end()
>
>
> .onException(Throwable.class).handled(true).useOriginalMessage().to("log:com.dynaroutebuilder.DynamicRouteStarter?level=ERROR&showException=true&showCaughtException=true&showStackTrace=true").end()
>
>
>                        .setHeader("eventid", constant(eventId))
>                        .process(protoBufMessageProcessor).routeId(name)
>                        .choice()
>
> .when(header("messagetype").isEqualTo(ProtoMessageType.ADD_EVENT))
>
> .marshal(jacksonDataFormatProcessor.getJacksonDataFormat()).process(new
> AddBetOfferEventUpdateProcessor())
>                        .setHeader(CacheConstants.CACHE_OPERATION,
> constant(CacheConstants.CACHE_OPERATION_ADD))
>                        .setHeader(CacheConstants.CACHE_KEY,
> header("eventid"))
>                        .to("log:ADD_EVENT")
>                        .to("cache://LiveOddsCache")
>                        .otherwise()
>                        .to("log:unhandledevent");
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5119339.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/

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
Hello,
Thanks for quick response.
I moved the exception clause to route scope but i get the following
exception while starting route.And this is because using recepientlist
within that exception handling.
===================================


2012-01-04 11:14:50,612 [                          main]
SportsBookRouteBuilder         ERROR Exchange[ExchangePattern:InOnly,
BodyType:String, Body:1000693194,
CaughtExceptionType:java.lang.UnsupportedOperationException,
CaughtExceptionMessage:null,
StackTrace:java.lang.UnsupportedOperationException
	at java.util.AbstractList.add(AbstractList.java:131)
	at java.util.AbstractList.add(AbstractList.java:91)
	at
org.apache.camel.model.OnExceptionDefinition.onException(OnExceptionDefinition.java:242)
	at
com.sbpushconversion.dynaroutebuilder.DynamicRouteStarter$1.configure(DynamicRouteStarter.java:45)
	at
org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:322)
	at
org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:277)
	at
org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:263)
	at
org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:603)
	at
com.sbpushconversion.dynaroutebuilder.DynamicRouteStarter.startRoute(DynamicRouteStarter.java:30)
	at
com.sbpushconversion.marcom.processor.KambiLiveEventProcessor.process(KambiLiveEventProcessor.java:32)
	at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
	at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
	at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
	at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:116)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:79)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
	at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
	at
org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)
	at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
	at
org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:572)
	at
org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:505)
	at
org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:218)
	at org.apache.camel.processor.Splitter.process(Splitter.java:96)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
	at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:90)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
	at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)
	at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:116)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:79)
	at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:111)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
	at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
	at
org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:61)
	at
org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)
	at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:104)
	at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
	at
org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63)
	at
org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:351)
	at
org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:323)
	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:222)
	at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:323)
	at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:168)
	at
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:110)
	at
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:123)
	at
com.sbpushconversion.dynaroutebuilder.SportsBookRouteBootStrapperComponent.onApplicationEvent(SportsBookRouteBootStrapperComponent.java:21)
	at
com.sbpushconversion.dynaroutebuilder.SportsBookRouteBootStrapperComponent.onApplicationEvent(SportsBookRouteBootStrapperComponent.java:11)
	at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
	at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
	at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
	at
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:467)
	at
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:483)
	at
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:358)
	at
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:325)
	at
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
	at javax.servlet.GenericServlet.init(GenericServlet.java:212)
	at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
	at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4420)
	at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4733)
	at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
	at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
	at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
	at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
	at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

=================================
And this is my amended route

  fromF("amqp:queue:%s", name)

                       
.onException(AddBetOfferEventNotFoundException.class,
OddsAddedBetOfferNotFoundException.class,
OddsRemovedEventNotFoundException.class,
OddsRemovedBetOfferNotFoundException.class,OddsUpdatedBetOfferNotFoundException.class,RemoveBetOfferNotFoundException.class,OpenAllBetOffersEventNotFoundException.class,SuspendAllBetOffersEventNotFoundException.class,UpdateBetOfferStatusEventNotFoundException.class,RemoveBetOfferEventNotFoundException.class,OddsUpdatedEventNotFoundException.class).handled(true)
                        .setHeader(Exchange.HTTP_METHOD,
constant(org.apache.camel.component.http4.HttpMethods.GET))
                        .recipientList(simple(kambiLiveEventUrlForOpenEvent,
String.class))
                        .setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_ADD))
                        .setHeader(CacheConstants.CACHE_KEY,
header("eventid"))
                        .convertBodyTo(String.class, "UTF-8")
                        .to("cache://LiveOddsCache").end()

                       
.onException(Throwable.class).handled(true).useOriginalMessage().to("log:com.dynaroutebuilder.DynamicRouteStarter?level=ERROR&showException=true&showCaughtException=true&showStackTrace=true").end()


                        .setHeader("eventid", constant(eventId))
                        .process(protoBufMessageProcessor).routeId(name)
                        .choice()
                       
.when(header("messagetype").isEqualTo(ProtoMessageType.ADD_EVENT))
                       
.marshal(jacksonDataFormatProcessor.getJacksonDataFormat()).process(new
AddBetOfferEventUpdateProcessor())
                        .setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_ADD))
                        .setHeader(CacheConstants.CACHE_KEY,
header("eventid"))
                        .to("log:ADD_EVENT")
                        .to("cache://LiveOddsCache")                        
                        .otherwise()
                        .to("log:unhandledevent");


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

Re: ProducerCache memory leak?

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

You need to use route scoped on exception to get that part removed as
part of removing a route.


On Wed, Jan 4, 2012 at 12:01 PM, suman <pr...@gmail.com> wrote:
> Hello,
> On further investigation,i found that the ProducerCache instances created
> for Exceptionhandlers arent being cleared.
>
> This is the one which i have in my route(To See complete route,please look
> at my earlier post in this email thread)
> I can clearly see that producercache for receipientlist and cache endpoint
> didnt got removed in removeservice method.
>
> ===========================
>
> onException(EventNotFoundException.class).handled(true)
>                        .setHeader(Exchange.HTTP_METHOD,
> constant(org.apache.camel.component.http4.HttpMethods.GET))
>                        .recipientList(simple(liveEventUrlForOpenEvent,
> String.class))
>                        .setHeader(CacheConstants.CACHE_OPERATION,
> constant(CacheConstants.CACHE_OPERATION_ADD))
>                        .setHeader(CacheConstants.CACHE_KEY,
> header("eventid"))
>                        .convertBodyTo(String.class, "UTF-8")
>                        .to("cache://LiveOddsCache");
> onException(Throwable.class).handled(true).useOriginalMessage().to("log:com.dynaroutebuilder.DynamicRouteStarter?level=ERROR&showException=true&showCaughtException=true&showStackTrace=true");
> =============================
>
> Let me know what you think
>
> Thanks
> Suman
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5119302.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/

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
Hello,
On further investigation,i found that the ProducerCache instances created
for Exceptionhandlers arent being cleared.

This is the one which i have in my route(To See complete route,please look
at my earlier post in this email thread)
I can clearly see that producercache for receipientlist and cache endpoint
didnt got removed in removeservice method.

===========================

onException(EventNotFoundException.class).handled(true)
                        .setHeader(Exchange.HTTP_METHOD,
constant(org.apache.camel.component.http4.HttpMethods.GET))
                        .recipientList(simple(liveEventUrlForOpenEvent,
String.class))
                        .setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_ADD))
                        .setHeader(CacheConstants.CACHE_KEY,
header("eventid"))
                        .convertBodyTo(String.class, "UTF-8")
                        .to("cache://LiveOddsCache");
onException(Throwable.class).handled(true).useOriginalMessage().to("log:com.dynaroutebuilder.DynamicRouteStarter?level=ERROR&showException=true&showCaughtException=true&showStackTrace=true");
=============================

Let me know what you think

Thanks
Suman



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

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
Not sure if I need to add routeid to onexception and stop that as well.I will
give it a try

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

Re: ProducerCache memory leak?

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jan 3, 2012 at 7:19 PM, suman <pr...@gmail.com> wrote:
> I counted the numbers which were created and the numbers which were removed..
> I can easily see producercache for receipientlist isn't being cleared in
> removeService() method of DefaultCamelContext.java.I will do some more
> analysis and keep you posted.
>

Good as I could not reproduce the issue. I have improved the unit test
ManagedRouteAddRemoveTest adding tests for recipient list and routing
slip as well.

I checked using the debugger as well that CamelContext does not hold
up any new producer caches.
Can you post a snippet of a route sample you use?

Mind that endpoints will be kept around in the endpoint registry
cache. You can control the size of this using a property on
CamelContext.
http://camel.apache.org/how-do-i-configure-the-maximum-endpoint-cache-size-for-camelcontext.html

> --
> View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5117604.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/

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
I counted the numbers which were created and the numbers which were removed..
I can easily see producercache for receipientlist isn't being cleared in
removeService() method of DefaultCamelContext.java.I will do some more
analysis and keep you posted.

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

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
Hello,
I tested this with 2.8.4 branch and the memory growth of producercache is
drastically reduced but hasn't gone away completely.
I looked at immediate dominator in eclipse memory analyzer tool and
SpringcamelContext seems to be holding producercache instances
Let me know if you need more information.

Thanks


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

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
Hi,
Thanks for quick resolution .I will give it a go next week and post the
results

Thanks
Suman

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

Re: ProducerCache memory leak?

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

The ticket is
https://issues.apache.org/jira/browse/CAMEL-4842

And a fix has been committed to trunk and 2.8 branch.

On Sat, Dec 31, 2011 at 1:57 PM, suman <pr...@gmail.com> wrote:
> Currently I have disabled jmx in my app as I saw memory leaks in the past
> Now I came to know it's because iam adding routes on the fly
>
> Thanks
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5112120.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/

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
Currently I have disabled jmx in my app as I saw memory leaks in the past
Now I came to know it's because iam adding routes on the fly

Thanks

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

Re: ProducerCache memory leak?

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Dec 30, 2011 at 2:44 PM, suman <pr...@gmail.com> wrote:
> Hello,
> Thanks for looking into this.
>

If you are using JMX then you may want to set registerNewRoutes=false,
to void enlisting JMX MBeans for the routes you add on-the-fly. This
avoids issues in 2.8.3 with the producer cache mbeans not being
removed when the route is removed. I am fixing this as well.

See detail at:
http://camel.apache.org/camel-jmx.html


> Regards
> Suman
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5110045.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/

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
Hello,
Thanks for looking into this.

Regards
Suman

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

Re: ProducerCache memory leak?

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Dec 30, 2011 at 2:21 PM, suman <pr...@gmail.com> wrote:
> I even moved the onexception clause from Global scope to Route scope,but
> still suffer from the same issue
>

Hi

Thanks for reporting.

I took a look in the source. And we need to remove the ProducerCache
from the lifecycle list that CamelContext keeps track of, when you
shutdown a route.

I will log a JIRA.



> --
> View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5110006.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/

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
I even moved the onexception clause from Global scope to Route scope,but
still suffer from the same issue

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

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
Hi Guys
Thanks for your reply.
I do stop route using API.I call  context.stopRoute() and
context.removeRoute() using routeid.
Here is my routebuilder.To be honest i have a Suspicion on "onException"
DSL.Iam not so sure.Let me know what you guys think

=====================================================================



 public void startRoute(CamelContext context, final String name, final
String eventId) throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                onException(AddEventNotFoundException.class).handled(true)                        
                        .setHeader(Exchange.HTTP_METHOD,
constant(org.apache.camel.component.http4.HttpMethods.GET))
                        .recipientList(simple(liveEventUrlForOpenEvent,
String.class))
                        .setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_ADD))
                        .setHeader(CacheConstants.CACHE_KEY,
header("eventid"))
                        .convertBodyTo(String.class, "UTF-8")
                        .to("cache://LiveCache")
                        .to("log:CACHEREFRESHEDFROMEXTERNALAPI?level=WARN");
               
               
onException(Throwable.class).handled(true).useOriginalMessage().to("log:com.unibet.dynaroutebuilder.DynamicRouteStarter?level=ERROR&showException=true&showCaughtException=true&showStackTrace=true");
               
this.getContext().getProperties().put(Exchange.LOG_DEBUG_BODY_STREAMS,
"true");
               
this.getContext().getProperties().put(Exchange.LOG_DEBUG_BODY_MAX_CHARS,
"100000");
               
this.getContext().getProperties().put(Exchange.MAXIMUM_CACHE_POOL_SIZE,
"50");

                fromF("amqp:queue:%s", name)
                        .setHeader("eventid", constant(eventId))
                        .process(protoBufMessageProcessor).routeId(name)
                        .choice()
                       
.when(header("messagetype").isEqualTo(ProtoMessageType.ADD_BET_OFFER))
                       
.marshal(jacksonDataFormatProcessor.getJacksonDataFormat()).process(new
AddEventUpdateProcessor())
                        .setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_ADD))
                        .setHeader(CacheConstants.CACHE_KEY,
header("eventid"))
                        .to("log:ADD_OFFER")
                        .to("cache://LiveCache")
                       
.when(header("messagetype").isEqualTo(ProtoMessageType.REMOVE_BET_OFFER))
                       
.marshal(jacksonDataFormatProcessor.getJacksonDataFormat()).process(new
RemoveEventUpdateProcessor())
                        .setHeader(CacheConstants.CACHE_OPERATION,
constant(CacheConstants.CACHE_OPERATION_UPDATE))
                        .setHeader(CacheConstants.CACHE_KEY,
header("eventid"))
                        .to("log:REMOVE_OFFER")
                        .to("cache://LiveCache")                       
                        .otherwise()
                        .to("log:unhandledevent");

            }

        });
    }


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

Re: ProducerCache memory leak?

Posted by Taariq Levack <ta...@gmail.com>.
Ah yes, it stops with the chain in my test loop. How do you stop the route?

Taariq

On Fri, Dec 30, 2011 at 3:50 AM, Willem Jiang <wi...@gmail.com>wrote:

> Hi,
>
> I don't know how you stop the route.
> The ProducerCache is service, it should be stop which the service chain.
> Please use the API stopRoute(String routeId) which is provided by
> CamelContext , instead of stopping the route itself.
>
>
> On 12/30/11 1:42 AM, suman wrote:
>
>> Hello All,
>> Iam using camel 2.8.3 and have an issue regarding ProducerCache objects
>> not
>> being garbage collected.
>> I browsed through this list regarding the same with not much luck.
>> I dynamically start and stop the route throughout my application and when
>> i
>> do that it seems like camel retains lot of SendProcessor and ProducerCache
>> instances(Within camel Spring context).
>> Is there any solution to this problem?
>>
>> Many Thanks
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.**
>> com/ProducerCache-memory-leak-**tp5108206p5108206.html<http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5108206.html>
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
> --
> Willem
> ------------------------------**----
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English)
>         http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang
>

Re: ProducerCache memory leak?

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

I don't know how you stop the route.
The ProducerCache is service, it should be stop which the service chain. 
Please use the API stopRoute(String routeId) which is provided by 
CamelContext , instead of stopping the route itself.

On 12/30/11 1:42 AM, suman wrote:
> Hello All,
> Iam using camel 2.8.3 and have an issue regarding ProducerCache objects not
> being garbage collected.
> I browsed through this list regarding the same with not much luck.
> I dynamically start and stop the route throughout my application and when i
> do that it seems like camel retains lot of SendProcessor and ProducerCache
> instances(Within camel Spring context).
> Is there any solution to this problem?
>
> Many Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5108206.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: ProducerCache memory leak?

Posted by Taariq Levack <ta...@gmail.com>.
Can we see the routebuilder?

On 29 Dec 2011, at 7:58 PM, suman <pr...@gmail.com> wrote:

> No iam not.For every "to" dsl in routebuilder,sendprocessor gets invoked and
> it is newing up producercache instances.
> 
> Thanks
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5108260.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ProducerCache memory leak?

Posted by suman <pr...@gmail.com>.
No iam not.For every "to" dsl in routebuilder,sendprocessor gets invoked and
it is newing up producercache instances.

Thanks

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

Re: ProducerCache memory leak?

Posted by Taariq Levack <ta...@gmail.com>.
Hi

Are you creating the producer yourself somewhere?
People often create a producer for every message.

Taariq

On 29 Dec 2011, at 7:42 PM, suman <pr...@gmail.com> wrote:

> Hello All,
> Iam using camel 2.8.3 and have an issue regarding ProducerCache objects not
> being garbage collected.
> I browsed through this list regarding the same with not much luck.
> I dynamically start and stop the route throughout my application and when i
> do that it seems like camel retains lot of SendProcessor and ProducerCache
> instances(Within camel Spring context).
> Is there any solution to this problem?
> 
> Many Thanks
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5108206.html
> Sent from the Camel - Users mailing list archive at Nabble.com.