You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jose Rodriguez <jo...@gmail.com> on 2013/11/25 15:07:45 UTC

OutOfMemory: ProviderFactory and SHARED_FACTORY

Hello,

We run tests with junit and Spring. Unfortunately, we have some nasty big
Spring application contexts.

Our cxf tests are integration ones between our rest services and clients
both defined with Spring.

After some out of memory exceptions, we have analysed the heap dumps. The
first issue was with the BusFactory. So as describe in cxf documentation we
set the default bus to null (BusFactory.setDefault(null)).

But that's not enough, we still have a "leak" through the SHARED_FACTORY
object in ProviderFactory. This instance retains the SpringBus and its big
spring application context.

After some debugging session, it seems that in Spring test case scenario
this static instance is not used. Everything is done using ProviderFactory.
createInstance(Bus bus) in the jax-rs stack.

Is there a way to cleanup/remove or to have a "minimal" bus retained by
this SHARED_FACTORY static instance?


Best Regards,
J. Rodriguez.

Re: OutOfMemory: ProviderFactory and SHARED_FACTORY

Posted by Jose Rodriguez <jo...@gmail.com>.
Hi,

Thanks for your answer.

Best Regards.
J. R.

Re: OutOfMemory: ProviderFactory and SHARED_FACTORY

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 25/11/13 14:07, Jose Rodriguez wrote:
> Hello,
>
> We run tests with junit and Spring. Unfortunately, we have some nasty big
> Spring application contexts.
>
> Our cxf tests are integration ones between our rest services and clients
> both defined with Spring.
>
> After some out of memory exceptions, we have analysed the heap dumps. The
> first issue was with the BusFactory. So as describe in cxf documentation we
> set the default bus to null (BusFactory.setDefault(null)).
>
> But that's not enough, we still have a "leak" through the SHARED_FACTORY
> object in ProviderFactory. This instance retains the SpringBus and its big
> spring application context.
>
> After some debugging session, it seems that in Spring test case scenario
> this static instance is not used. Everything is done using ProviderFactory.
> createInstance(Bus bus) in the jax-rs stack.
>
> Is there a way to cleanup/remove or to have a "minimal" bus retained by
> this SHARED_FACTORY static instance?
>
The static instance has gone in CXF 3.0.0-milestone, in 2.7.x and 
earlier you can do ProviderFactory.getSharedInstance(), but 
unfortunately ProviderFactory has no Bus getter, I'm adding it now to 
CXF 2.7.9-SNAPSHOT, in meantime, please try access the private Bus 
reflectively, cast to SpringBus and call destroyBeans on it

HTH
Sergey

>
> Best Regards,
> J. Rodriguez.
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com