activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chester_Zheng <chester_zh...@sina.com>
Subject The connection is already closed
Date Thu, 27 Apr 2017 06:25:35 GMT
Hi, Dear All
I match a strange problem. We built a master/slave cluster of ActiveMQ by
using zookeeper as a registration center.
First of all, we use the "CachingConnectionFactory" which get from "Spring"
to create the ActiveMQ connection.
Then, we establish a custom session pool that it's easy to get a session for
the high-concurrency scenarios.

Strangely, both of test and pulbic enviornment java code is the same, but I
didn't find this problem on own test enviornment.

P.S.I did the pressure test on the test-enviornment.

Is it my wrong way to use or a real bug of ActiveMQ? When And where the
ActiveMQ will invoke the method named "close" by itself?

I've already seen the ActiveMQ-source. The "CachingConnectionFactory" is
extended "SingleConnectionFactory".And I seen the method named "close".
There is a private final field named "closed". And the default value is
"false". When somewhere invokes the close method, then the filed "closed"
will change to "true". 

If you guys met similar like what I described, Please let me know. Thanks a
lot.

Here is the error message:

org.apache.activemq.ConnectionClosedException: The connection is already
closed
        at
org.apache.activemq.ActiveMQConnection.checkClosed(ActiveMQConnection.java:1477)
        at
org.apache.activemq.ActiveMQConnection.checkClosedOrFailed(ActiveMQConnection.java:1464)
        at
org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:323)
        at
org.springframework.jms.connection.SingleConnectionFactory.createSession(SingleConnectionFactory.java:416)
        at
org.springframework.jms.connection.CachingConnectionFactory.getSession(CachingConnectionFactory.java:234)
        at
org.springframework.jms.connection.SingleConnectionFactory$SharedConnectionInvocationHandler.invoke(SingleConnectionFactory.java:556)
        at com.sun.proxy.$Proxy16.createSession(Unknown Source)
        at
com.bs.pid.link.dc.activemq.util.SessionFactory$1.run(SessionFactory.java:120)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

The configuration is :

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="bs"
schedulePeriodForDestinationPurge="10000"  useShutdownHook="false" 
dataDirectory="${activemq.data}"
splitSystemUsageForProducersConsumers="true" producerSystemUsagePortion="50"
consumerSystemUsagePortion="50">

        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" >
                  <pendingMessageLimitStrategy>
                    <constantPendingMessageLimitStrategy limit="1000"/>
                  </pendingMessageLimitStrategy>
                </policyEntry>
              <policyEntry queue=">" gcInactiveDestinations="true"
inactiveTimoutBeforeGC="30000"  producerFlowControl="true"
memoryLimit="512mb">
             
             <dispatchPolicy>
               <strictOrderDispatchPolicy/>
             </dispatchPolicy>
             <subscriptionRecoveryPolicy>
               <lastImageSubscriptionRecoveryPolicy/>
             </subscriptionRecoveryPolicy>             
             <pendingQueuePolicy>
               <storeCursor/>
             </pendingQueuePolicy>
                </policyEntry>
               </policyEntries>
            </policyMap>
        </destinationPolicy>

        <managementContext>
            <managementContext createConnector="false"/>
        </managementContext>

        <persistenceAdapter>
            <replicatedLevelDB
                directory="activemq-data"
                replicas="3"
                bind="tcp://0.0.0.0:61619"
               
zkAddress="xxx.xxx.xxx.xxx:2181,xxx.xxx.xxx.xxx:2181,xxx.xxx.xxx.xxx:2181"
                zkPath="/opt/apache-activemq-5.13.4/data/leveldb-stores"
                zkSessionTimeout="3s"
                hostname="xxx.xxx.xxx.xxx"
                weight="1"
      />

    </persistenceAdapter>
          <systemUsage>
            <systemUsage>
                <memoryUsage>
                      <memoryUsage limit="1024 mb"/>
                </memoryUsage>
                <storeUsage>
                    <storeUsage limit="20 gb"/>
                </storeUsage>
                <tempUsage>
                    <tempUsage limit="10 gb"/>
                </tempUsage>
            </systemUsage>
        </systemUsage>

        <transportConnectors>
            
            <transportConnector name="openwire"
uri="tcp://0.0.0.0:61616?maximumConnections=3000&amp;wireFormat.maxFrameSize=104857600"/>
        </transportConnectors>

        
        <shutdownHooks>
            <bean xmlns="http://www.springframework.org/schema/beans"
class="org.apache.activemq.hooks.SpringContextHook" />
        </shutdownHooks>
    </broker>


The client URL is :

failover\://(tcp\:/xxx.xxx.xxx.xxx:61616?tcpNoDelay\=true,tcp\://xxx.xxx.xxx.xxx:61616?tcpNoDelay\=true,tcp\://xxx.xxx.xxx.xxx:61616?tcpNoDelay\=true)?nested.wireFormat.maxInactivityDuration\=3000&nested.wireFormat.tightEncodingEnabled=false&nested.connectionTimeout\=0&timeout\=200&initialReconnectDelay\=10&startupMaxReconnectAttempts\=2&maxReconnectDelay\=100&jms.prefetchPolicy.all\=2&randomize\=false&backup\=true






--
View this message in context: http://activemq.2283324.n4.nabble.com/The-connection-is-already-closed-tp4725268.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message