6 Replies Latest reply on Aug 25, 2006 2:35 PM by genman

    Memory leak

    nirav30

      Hi All,

      We are observing memory leak while running our application on JBoss 4.0.2. We attached the profiling tool - JProfiler to trace the memory leak and we found that the class[] (Proxy classes) is increasing drastically which is not getting garbage collected.

      The "HeapWalker" shows that EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run() has allocated some memory which is not being freed.

      The application uses MDBs extensively and the JMS server is configured to NullPersistance.

      What could be the possible cause for this leak?

      Thanks in advance,
      Nirav.

        • 1. Re: Memory leak
          nirav30

          FYI...

          We are closing all the Queue connection, session and sender properly.

          • 2. Re: Memory leak
            genman


            Can you post the reference tree? Also, what JVM do you use?

            • 3. Re: Memory leak
              nirav30

              We are using Sun JDK 1.5

              Well, the problem is resolved. The issue was with JMS connection factory. There is some memory leak with 'RMIConnectionFactory'. We changed our code to use 'java:/ConnectionFactory' [in memory connection factory] and now the memory is settling down properly.

              Just to add:
              The leak in RMIConnectionFactory is visible, if we have a client which calls stateless session bean and this SLSB in turn pushes a message to JMS Queue.

              • 4. Re: Memory leak
                jozerskiy

                Nirav...

                I am new to jboss. Our application has a memory leak on the similar issue. some UIL2 threads keep multiplying about every minute. An example of such thread follows on the bottom of my message.

                My question is this: Where do i change the connection factory type to "java:/ConnectionFactory"? I searched all of my jboss config files for "RMIConnectionFactory" and did not fing any references.

                We are using jboss version 4.0.1

                If you can offer any advice, it would be really appreciated.
                thanks
                julia
                ************************************************
                Name: UIL2(SocketManager.MsgPool@f34a08 client=192.168.30.237:8093)#1
                State: TIMED_WAITING on EDU.oswego.cs.dl.util.concurrent.LinkedNode@eaabad
                Total blocked: 0 Total waited: 2

                Stack trace:
                java.lang.Object.wait(Native Method)
                EDU.oswego.cs.dl.util.concurrent.SynchronousChannel.poll(SynchronousChannel.java:353)
                EDU.oswego.cs.dl.util.concurrent.PooledExecutor.getTask(PooledExecutor.java:723)
                EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:747)
                java.lang.Thread.run(Thread.java:619)

                • 5. Re: Memory leak
                  nirav30

                  Hello Julia,

                  I am not sure about JBoss 4.0.1 version as we are using JBos 4.2.

                  But, here is a link you can have a look to find more details about where you can change RMIConnectionFactory settings.

                  http://docs.jboss.org/jbossas/jboss4guide/r2/html/ch6.chapt.html

                  You may need to comment the ConnectionFactory settings in deploy/jms/rmi-il-service.xml and enable the same in deploy/jms/jvm-il-service.xml.

                  Hope this would be useful.

                  Cheers,
                  Nirav.

                  • 6. Re: Memory leak
                    genman


                    It's recommended practice to use JCA (i.e. java:/JmsXA ) for all your in-server messaging. Using JCA will guard against resource leakage in your own code.

                    It's also better practice code against a generic entity (JNDI entry) than a particular provider name.