Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-4507

FailoverTransport throws NullPointerException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 5.8.0
    • 5.9.0
    • Transport
    • Win 7, java 7

    Description

      The Failovertransport throws NullPointer Exceptions in case of a failover to another primary host for the following broker url:

      failover:(tcp://primary_1:61616,tcp://primary_2:61616,tcp://secondary_1:61616,tcp://secondary_2:61616)?randomize=false&priorityBackup=true&priorityURIs=tcp://primary_1:61616,tcp://primary_2:61616&jms.alwaysSyncSend=true

      Stack trace:
      Exception in thread "ActiveMQ Task-2" java.lang.NullPointerException
      at org.apache.activemq.transport.failover.FailoverTransport.disposeTransport(FailoverTransport.java:231)
      at org.apache.activemq.transport.failover.FailoverTransport.doReconnect(FailoverTransport.java:954)
      at org.apache.activemq.transport.failover.FailoverTransport$2.iterate(FailoverTransport.java:143)
      at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:129)
      at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:47)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)

      I assume that this is a copy-paste bug, since in the current revision (1478184, see link below) of the FailoverTransport on line #966, the variable 'old' should be checked for null instead of 'transport'. However, I have no clue why 'old' is null even though the transport was handling messages before the failover.

      http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java?revision=1478184&view=markup

      Current code:
      955 Transport old = this.connectedTransport.getAndSet(null);
      966 if (transport != null) {
      967 disposeTransport(old);
      968 }

      Corrected code:
      955 Transport old = this.connectedTransport.getAndSet(null);
      966 if (old!= null) {
      967 disposeTransport(old);
      968 }

      Attachments

        Activity

          People

            gtully Gary Tully
            tom_guenter Thomas Günter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: