In your client code, it sounds like you're calling session.createProducer() many times, possibly in a loop. Are you closing each producer when you're done with it, before you create the next one? If not, the resource leak is in your code, not ActiveMQ's.
Tim On Jul 19, 2016 5:41 AM, "RuralHunter" <ruralhun...@gmail.com> wrote: > Hi, > I'm using activemq 5.13.3. I'm seeing the producer count on the broker side > keeps increasing and never shrinks. I inspected the value > TotalProducerCount > of the broker via jmx. And it is also verified by the class count of > org.apache.activemq.broker.jmx.ProducerView in jvm heap class histogram. > We found the session.createProducer() method got slower and slower at the > client side if we keep activemq running for long time. We checked all other > metrics both activemq and the server where it runs and could not find any > other thing abnormal. The stack of the activemq server shows many of the > threads are doing this: > java.lang.Thread.State: WAITING (parking) > at sun.misc.Unsafe.park(Native Method) > - parking to wait for <0x00007fcfdb2edeb8> (a > java.util.concurrent.locks.ReentrantLock$NonfairSync) > at > java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) > at > > java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834) > at > > java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867) > at > > java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197) > at > > java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:214) > at > java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:290) > at > > java.util.concurrent.CopyOnWriteArrayList.addIfAbsent(CopyOnWriteArrayList.java:585) > at > java.util.concurrent.CopyOnWriteArraySet.add(CopyOnWriteArraySet.java:248) > at > > org.apache.activemq.broker.jmx.ManagedRegionBroker.registerProducer(ManagedRegionBroker.java:384) > at > > org.apache.activemq.broker.jmx.ManagedRegionBroker.addProducer(ManagedRegionBroker.java:268) > at > > org.apache.activemq.broker.CompositeDestinationBroker.addProducer(CompositeDestinationBroker.java:56) > at > org.apache.activemq.broker.BrokerFilter.addProducer(BrokerFilter.java:108) > at > > org.apache.activemq.broker.MutableBrokerFilter.addProducer(MutableBrokerFilter.java:113) > at > > org.apache.activemq.broker.TransportConnection.processAddProducer(TransportConnection.java:618) > at > org.apache.activemq.command.ProducerInfo.visit(ProducerInfo.java:108) > at > > org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:338) > at > > org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:188) > at > > org.apache.activemq.transport.MutexTransport.onCommand(MutexTransport.java:50) > at > > org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:125) > at > > org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:300) > at > > org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) > at > org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:233) > at > org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:215) > at java.lang.Thread.run(Thread.java:745) > > The TotalProducerCount is more than 120000 when I checked it last time. > If I restart the activemq, the session.createProducer() becomes very quicks > at client side. I also noticed the TotalConnectionsCount also increases > with > the TotalProducerCount. So looks there is some connection/producer leak at > server side. How should I handle this? > > > > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/Producer-count-keeps-increasing-tp4714087.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. >