ActiveMQ
  1. ActiveMQ
  2. AMQ-3793

common use of activemq with failover transport causes deadlock

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 5.5.1
    • Fix Version/s: None
    • Component/s: Transport
    • Labels:
      None
    • Environment:

      jdk1.6 ;log4j-1.2.16

      Description

      I just use jmsAppender as below:

      log.info("testsetstsettset");

      while the log4j.properties :

      log4j.category.test = jms

      log4j.appender.jms=org.apache.log4j.net.JMSAppender
      log4j.appender.jms.InitialContextFactoryName=org.apache.activemq.jndi.ActiveMQInitialContextFactory
      log4j.appender.jms.ProviderURL=failover://(tcp://localhost:61616)
      log4j.appender.jms.TopicBindingName=topic
      log4j.appender.jms.TopicConnectionFactoryBindingName=ConnectionFactory

      when I run this program, it will causes a deadlock hanging.

      stack:

      "ActiveMQ Task-1" daemon prio=10 tid=0x00002aaab442a000 nid=0x7b13 in Object.wait() [0x000000004367e000]
      java.lang.Thread.State: RUNNABLE
      at org.apache.log4j.LogManager.getLoggerRepository(LogManager.java:196)
      at org.apache.log4j.LogManager.getLogger(LogManager.java:228)
      at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:73)

      • locked <0x00000000eb35cfc8> (a org.slf4j.impl.Log4jLoggerFactory)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:249)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261)
        at org.apache.activemq.transport.tcp.TcpTransportFactory.<clinit>(TcpTransportFactory.java:48)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at org.apache.activemq.util.FactoryFinder$StandaloneObjectFactory.create(FactoryFinder.java:61)
        at org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:146)
        at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:201)
        at org.apache.activemq.transport.TransportFactory.compositeConnect(TransportFactory.java:92)
        at org.apache.activemq.transport.failover.FailoverTransport.doReconnect(FailoverTransport.java:857)
      • locked <0x00000000eb47fff8> (a java.lang.Object)
        at org.apache.activemq.transport.failover.FailoverTransport$2.iterate(FailoverTransport.java:136)
      • locked <0x00000000eb480008> (a java.lang.Object)
        at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:127)
        at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

      "main" prio=10 tid=0x000000004d9e5800 nid=0x7aea waiting for monitor entry [0x00000000417ca000]
      java.lang.Thread.State: BLOCKED (on object monitor)
      at org.apache.activemq.transport.failover.FailoverTransport.oneway(FailoverTransport.java:482)

      • waiting to lock <0x00000000eb47fff8> (a java.lang.Object)
        at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:40)
      • locked <0x00000000eb514470> (a java.lang.Object)
        at org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:81)
        at org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:86)
        at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1284)
        at org.apache.activemq.ActiveMQConnection.ensureConnectionInfoSent(ActiveMQConnection.java:1392)
      • locked <0x00000000eb5962a8> (a java.lang.Object)
        at org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:309)
        at org.apache.activemq.ActiveMQConnection.createTopicSession(ActiveMQConnection.java:1087)
        at org.apache.log4j.net.JMSAppender.activateOptions(JMSAppender.java:218)
        at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
        at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172)
        at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104)
        at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:809)
        at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:735)
        at org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigurator.java:639)
      • locked <0x00000000eb285bf8> (a org.apache.log4j.Logger)
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:504)
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:547)
        at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:483)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
        at org.apache.log4j.Logger.getLogger(Logger.java:104)
        at org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:229)
        at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:65)

      If I put the logic in JMSAppender.activateOption into another method and invoke this method in append method, the problem will no longer appear.
      Is there something mistake when I use activemq and jmsAppender ?

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Alex Ge
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development