Announcement Announcement Module
Collapse
No announcement yet.
memory leaks in CXF with spring while using WebClient APIs Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • memory leaks in CXF with spring while using WebClient APIs

    Hello All,

    First of all, apologies if putting this question in a wrong group, let me know if I have to move to other groups.

    Problem - We are facing a very weird memory issue while using spring (3.0.5.RELEASE) with Apache-CXF(2.4.2). We are trying to make a REST(GET) call using Apache CXF WebClient.get().Each outbound call URL is getting configured as a bean in the Spring Container.

    Description -
    1.Placeholder in Spring where the URL is getting configured as a Bean
    Class Name - AbstractBeanFactory
    private final Set<String> alreadyCreated = Collections.synchronizedSet(new HashSet<String>());

    2.Reason

    During the WebClient.get call CXF prepares conduit to channel the message to destination. Since it is a HTTP call HTTPTransportFactory is used to create HTTP Conduit for the endpoint.
    This is done by HTTPTransportFactory.getConduit method.
    HTTPTransportFactory.getConduit invokes HTTPTransportFactory.configure(Object bean, String name, String extraName)

    Code:
     
    protected void configure(Object bean, String name, String extraName) {
            Configurer configurer = bus.getExtension(Configurer.class);
            if (null != configurer) {
                configurer.configureBean(name, bean);
                if (extraName != null) {
                    configurer.configureBean(extraName, bean);
                }
            }
        }
    name parameter value is - {http://<ip>:<port>/<application-context>/user/96BEEBE3119B4B809F35CFFAF5EA9803/detail}WebClient.http-conduit

    extraName parameter value is - http://<ip>:<port>/<application-context>/user/96BEEBE3119B4B809F35CFFAF5EA9803/detail

    Since CXF by default uses SpringBus,the configurer class returned for bus.getExtension(Configurer.class) call is org.apache.cxf.configuration.spring.ConfigurerImpl .
    This class ends up configuring both the above mentioned URL as bean in Spring.

    This bean names are keep on adding to a Set instance alreadyCreated which never get garbage collected, and keep increasing the memory footprint and finally causing OutOfMemory issue.

    Thanks in advance for showing any pointer.

    Thanks
    Ajit Das
    Last edited by ajitamitav; Jan 30th, 2013, 02:52 PM.

  • #2
    Hi Ajit,

    After doing memory analysis, I have seen exactly the same happening in my application. I'm also using WebClient to make REST calls to an external system and can see set "alreadyCreated" grow with each call. I'm using Spring 3.1.3 RELEASE with CXF 2.7.0 by the way.

    Did you already file a bug report?

    Cheers,
    Jan

    Comment


    • #3
      Hi Jan,

      I don't know if this is happening due to some version compatibility issue or it's a known bug, if anyone from SpringSource can confirm this I can open a bug report for this.

      Thanks & Regards,
      Ajit Das

      Comment


      • #4
        Hi Ajit,

        The configuration that I'm using (Spring 3.1.3 RELEASE with CXF 2.7.0 ) contains the latest libraries of both frameworks and they should be compatible. I think it would be too much of a coincidence that both of it see this happening while we're at very different version-levels.

        I think the reason that not many people have run into this problem is the massive amount of calls you have to make before you actually notice that you're running out of memory.

        Perhaps it is best to just post a bug-report to attract attention of the springsource developers?

        Best,
        Jan

        Comment


        • #5
          Jan,

          Perhaps this is more related to CXF APIs as it's a extension of CXF with Spring APIs, and I have already created a defect against it.

          You can find it here @https://issues.apache.org/jira/browse/CXF-4795

          Hopefully it will get addressed soon.

          Thanks
          Ajit

          Comment


          • #6
            Thanks Ajit,

            Last night, I noticed that the developers had already picked up your bug report and seem to have pushed a potential solution in the nightly build.

            I have just rebuilt my project based on the 2.7.4-SNAPSHOT from the maven snapshot repository and am running new tests now. Hoping for the best

            Cheers,
            Jan

            Comment

            Working...
            X