Results 1 to 6 of 6

Thread: Possible memory leak with SLSB on WL5.1

  1. #1
    Join Date
    Aug 2005
    Posts
    39

    Default Possible memory leak with SLSB on WL5.1

    I've been using SimpleRemoteStatelessSessionProxyFactoryBean to access SLSBs on a Weblogic 5.1 (yes, very old) server, and it would appear to be causing a memory leak in the client VM.

    My appcontext on the client is along the lines of:

    Code:
    <bean id="myProxyBean" class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean">
       <property name="jndiName" value="mySLSBHomeInterfaceName" />
       <property name="businessInterface" value="myBusinessInterface" />
    </bean>
    This was used to replace code like this:

    Code:
    public static MyObject lookup&#40;String objId&#41; throws MyException &#123;
    		MyRemoteInterface remote = null;
    		try &#123;
    			MySLSBHome home = &#40;MySLSBHome&#41; NamingUtil.lookup&#40;"mySLSBHomeInterfaceName"&#41;;
    			remote = home.create&#40;&#41;;
    			return remote.lookup&#40;objId&#41;;
    		&#125; catch &#40;CreateException e&#41; &#123;
    			throw new MyException &#40;e&#41;;
    		&#125; catch &#40;NamingException e&#41; &#123;
    			throw new MyException &#40;e&#41;;
    		&#125; catch &#40;EJBException e&#41; &#123;
    			throw new MyException &#40;e&#41;;
    		&#125; catch &#40;RemoteException e&#41; &#123;
    			throw new MyException &#40;e&#41;;
    		&#125; finally &#123;
    			ObjectUtil.removeEJB&#40;tpl&#41;;
    		&#125;
    	&#125;
    In other words, standard, old-fashioned boilerplate stuff.


    Now, functionally, the Spring proxy approach works just fine, but after a certain amount of time, the VM is running out of memory. It happens every time when using the Spring proxy, but never when using the old-style manual code.

    Looking through the sourcecode for SimpleRemoteStatelessSessionProxyFactoryBean, it appears to be doing more or less the same logic as the code shown above.

    I've tried running the VM through a profiler, but the memory leak doesn't manifest itself when being profiled (typical).

    Factors that may be of interest:

    Client: Sun 1.3.1 VM
    Server: Weblogic 5.1 running on Sun 1.3.1 VM

    I can see that potentially there may be issues when running on old VMs and old appservers, but as I said, the actual handling of the SLSB invocations is pretty much the same between the Spring code and my own code.

    The leak is proving to be quite a mystery. Any light anyone could shed on this would be greatly appreciated.

  2. #2
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    That's odd indeed.

    Spring's remote EJB accessors "create" a new SLSB instance for each invocation and "remove" it afterwards - in a finally block, so even in case of exceptions. I can't see any potential leak there either...

    Juergen

  3. #3
    Join Date
    Aug 2005
    Posts
    39

    Default

    My hunch is that it isn't anything to do with the EJB access code itself, but rather than AOP shenanigans. This is an awfully old VM we're talking about (the original 1.3.1, not even 1.3.1_01 or the like), so I wouldn't be too surprised if Spring's fancy footwork is causing it to leak classes or classloaders or something along those lines.

  4. #4
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    I guess you are a candidate for the oldest VM I've encountered this year ;-) Wait, actually I had a guy running on Sun JDK 1.3.0 (!), who had an odd issue back in the Spring 1.2 RC2 days, which we fixed just to stay compatible with the Sun 1.3 classic VM...

    WebLogic 5.1 is definitely a candidate for the oldest WebLogic version I've encountered this year, though. I thought WebLogic 6.1 was the oldest I would get ;-)

    I assume you're not running CGLIB but plain old JDK dynamic proxies... It could easily be that the original Sun 1.3.1 VM had an issue with dynamic proxies, causing potential memory leaks. Is there any chance you could upgrade to 1.3.1_15, at least for testing purposes?

    Juergen

  5. #5
    Join Date
    Aug 2005
    Posts
    39

    Default

    Quote Originally Posted by Juergen Hoeller
    I assume you're not running CGLIB but plain old JDK dynamic proxies... It could easily be that the original Sun 1.3.1 VM had an issue with dynamic proxies, causing potential memory leaks.
    Actually, CGLIB is in there, for use by other stuff, and Spring is picking it up and using it.

    Quote Originally Posted by Juergen Hoeller
    Is there any chance you could upgrade to 1.3.1_15, at least for testing purposes?
    That's not a bad idea. Unfortunately, WL5.1 (or the patch version that we use, anyway), is not supported on anything other than vanilla 1.3.1. However, our unittest VM runs on its own, and could be made to run on a later VM, maybe even 1.4 (*faints*), just to see if the leak repeats itself.

    cheers

  6. #6
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    Quote Originally Posted by skaffman
    Actually, CGLIB is in there, for use by other stuff, and Spring is picking it up and using it.
    Note that, while Spring will detect CGLIB when available, it's only gonna use CGLIB when actually needed: that is, for proxying full target classes. CGLIB is by default not gonna be used for proxying interfaces: Spring will always use JDK dynamic proxies for this, unless you explicitly request "proxyTargetClass=true" through the proxy definition.

    Juergen

Similar Threads

  1. Memory Leak
    By Jim Reed in forum Container
    Replies: 15
    Last Post: Sep 30th, 2008, 02:49 PM
  2. Memory leak using RMI
    By josep in forum Remoting
    Replies: 4
    Last Post: May 29th, 2007, 10:51 AM
  3. Replies: 16
    Last Post: Nov 7th, 2005, 10:18 AM
  4. Memory leak problem with Spring app in tomcat
    By Mammux in forum Container
    Replies: 3
    Last Post: Sep 5th, 2005, 06:57 AM
  5. Suspicous memory leak ?
    By ImanRahmati in forum Container
    Replies: 1
    Last Post: May 1st, 2005, 10:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •