Java memor leak

Hi,

I am running with serios problem in openfire, please help me to tune it to work fine.

I am running Openfire 3.8.2 with ldap backend. I have around 8000 users in ldap database and in that avg 2000 users will be concorrent online users in openfire.

Initially I didnt use connection manager to run the server. once in a week or byweek server shows out of memory and I forced to restart the server to work again.Then i decided to use connection manager after going through blogs. After using connection manager, openfire is running good but connection manager running out of memory.

I am using jre1.7.0_45

memory setting of openfire: OPENFIRE_OPTS="-Xmx4596m"

memory setting of connection manager : JVM_SETTINGS="-Xms512m -Xmx3024m"

error i am getting in connection manager when its going out of memory

I have analysed the memory dump using JHAT. Below is the instance count generated through JHAT

Instance Counts for All Classes (including platform)

116835 instances of class java.util.HashMap$Entry

65899 instances of class [B

59965 instances of class java.util.TreeMap$Entry

47852 instances of class [I

33249 instances of class java.lang.Object

26156 instances of class java.math.BigInteger

25383 instances of class [C

19750 instances of class java.lang.String

14180 instances of class java.util.LinkedHashMap$Entry

13057 instances of class [Ljava.util.HashMap$Entry;

10982 instances of class [Ljava.lang.String;

10954 instances of class java.util.HashMap

10685 instances of class org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl

10685 instances of class org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1

10073 instances of class java.util.concurrent.ConcurrentLinkedQueue$Node

8596 instances of class java.lang.ref.ReferenceQueue$Lock

8596 instances of class java.util.LinkedHashMap

8594 instances of class java.lang.ref.ReferenceQueue

8562 instances of class sun.security.util.MemoryCache

8553 instances of class java.net.InetSocketAddress

8553 instances of class java.net.InetSocketAddress$InetSocketAddressHolder

8545 instances of class java.security.MessageDigest$Delegate

7369 instances of class java.util.concurrent.atomic.AtomicInteger

7032 instances of class [Ljava.lang.Object;

6600 instances of class java.util.ArrayList

6533 instances of class java.util.LinkedList

6423 instances of class java.util.concurrent.ConcurrentLinkedQueue

6418 instances of class [Ljava.security.cert.X509Certificate;

6408 instances of class sun.security.provider.MD5

4884 instances of class java.nio.HeapByteBuffer

4799 instances of class java.nio.DirectByteBuffer

4793 instances of class java.nio.DirectByteBuffer$Deallocator

4793 instances of class sun.misc.Cleaner

4584 instances of class sun.security.util.ObjectIdentifier

4401 instances of class sun.security.x509.AlgorithmId

4322 instances of class java.lang.ref.Finalizer

4282 instances of class java.net.InetAddress$InetAddressHolder

4280 instances of class sun.security.ssl.EphemeralKeyManager$EphemeralKeyPair

4280 instances of class sun.security.ssl.SSLSessionContextImpl

4280 instances of class sun.security.ssl.SunX509KeyManagerImpl$X509Credentials

4279 instances of class java.net.Inet4Address

4275 instances of class java.lang.StringBuilder

4273 instances of class sun.security.ssl.CipherBox

4273 instances of class sun.security.ssl.MAC

4272 instances of class com.sun.crypto.provider.ARCFOURCipher

4272 instances of class com.sun.crypto.provider.HmacCore

4272 instances of class com.sun.crypto.provider.HmacMD5

4272 instances of class javax.crypto.Cipher

4272 instances of class javax.crypto.Mac

3385 instances of class java.util.concurrent.ConcurrentHashMap$HashEntry

2676 instances of class [S

2539 instances of class sun.security.util.DerInputBuffer

Heap Histogram

All Classes (excluding platform)

Class Instance Count Total Size

class [B 65899 3006797536

class [C 25383 15929672

class [I 47852 8387968

class java.util.HashMap$Entry 116835 3271380

class [Ljava.util.HashMap$Entry; 13057 2600880

class java.util.TreeMap$Entry 59965 2458565

class [Ljava.lang.String; 10982 1164920

class java.math.BigInteger 26156 732368

class [Ljava.lang.Object; 7032 709968

class java.util.LinkedHashMap$Entry 14180 623920

class org.apache.mina.transport.socket.nio.SocketSessionImpl 2137 585538

class java.util.HashMap 10954 569608

class java.util.LinkedHashMap 8596 524356

class org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl 10685 512880

class sun.security.ssl.SSLEngineImpl 2137 446633

class sun.security.provider.MD5 6408 435744

class javax.crypto.Cipher 4272 363120

class java.lang.String 19750 316000

class sun.nio.ch.SocketChannelImpl 2137 312002

Let me know if you can make out anything abnormal out of this? I would be very helpful if you can through some light on this

I can paste if you need any other out of JHAT

Many Thanks,

Shamjith

Can you upload a heapdump somewhere or are there some confidential class names in it? I think pubsub did name objects like nodes, so there may be security issues.

3 GB of bytes objects look odd, especially as there is no huge hashmap.

Or try to find a route cause, maybe with MAT http://www.eclipse.org/mat/ if JHat does not work for you.

1 Like

Hi LG,

In eclipse I see it is suspecting 1 instance and discription below

2,137 instances of “org.apache.mina.transport.socket.nio.SocketSessionImpl”, loaded by “org.jivesoftware.multiplexer.starter.JiveClassLoader @ 0x77ce26790” occupy 3,013,705,776 (98.77%) bytes. These instances are referenced from one instance of “java.util.HashMap$Entry[]”, loaded by “”

Keywords
org.jivesoftware.multiplexer.starter.JiveClassLoader @ 0x77ce26790
java.util.HashMap$Entry[]
org.apache.mina.transport.socket.nio.SocketSessionImpl

I can upload heapdump if you are not getting any clue from this?? Thanks

2137x org.apache.mina sounds fine as you have 2000 connections.Each instance uses about 1,5 MB - this may be too much. Or there may be some instances using too much. Without the dump this is hard to tell - it would help if you would uoload it somewhere.

Is it possibke for you to create a dump when it is running fine with 2000 users? So one has a reference.