[ 
https://issues.apache.org/activemq/browse/AMQ-2772?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Siim Kaalep updated AMQ-2772:
-----------------------------

    Description: 
ActiveMQConnection.transportInterupted assumes that
dispatchers.size() == all session's consumers + one advisoryConsumer

But ActiveMQConnectionConsumer also registers itself as dispatcher in 
constructor.

On failover attempt connection will remain in waiting state. 
Logging "dispatch paused, waiting for outstanding dispatch interruption 
processing (1) to complete.."

ActiveMQConnectionConsumer is used in ActiveMQ resource adapter in 
ActiveMQEndpointWorker.


Robust fix:
{noformat} 
Index: 
trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
===================================================================
--- 
trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
+++ 
trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
@@ -1840,7 +1840,7 @@
        }
 
     public void transportInterupted() {
-        transportInterruptionProcessingComplete = new 
CountDownLatch(dispatchers.size() - (advisoryConsumer != null ? 1:0));
+        transportInterruptionProcessingComplete = new 
CountDownLatch(dispatchers.size() - (advisoryConsumer != null ? 1:0) - 
connectionConsumers.size());
         if (LOG.isDebugEnabled()) {
             LOG.debug("transport interrupted, dispatchers: " + 
transportInterruptionProcessingComplete.getCount());
         }
{noformat} 

  was:
ActiveMQConnection.transportInterupted assumes that
dispatchers.size() == all session's consumers + one advisoryConsumer

But ActiveMQConnectionConsumer also registers itself as dispatcher in 
constructor.

On failover attempt connection will remain in waiting state. 
Logging "dispatch paused, waiting for outstanding dispatch interruption 
processing (1) to complete.."

ActiveMQConnectionConsumer is used in ActiveMQ resource adapter in 
ActiveMQEndpointWorker.


Robust fix:

Index: 
trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
===================================================================
--- 
trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
+++ 
trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
@@ -1840,7 +1840,7 @@
        }
 
     public void transportInterupted() {
-        transportInterruptionProcessingComplete = new 
CountDownLatch(dispatchers.size() - (advisoryConsumer != null ? 1:0));
+        transportInterruptionProcessingComplete = new 
CountDownLatch(dispatchers.size() - (advisoryConsumer != null ? 1:0) - 
connectionConsumers.size());
         if (LOG.isDebugEnabled()) {
             LOG.debug("transport interrupted, dispatchers: " + 
transportInterruptionProcessingComplete.getCount());
         }



> ActiveMQConnectionConsumer will break failover
> ----------------------------------------------
>
>                 Key: AMQ-2772
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2772
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Connector
>    Affects Versions: 5.3.2
>            Reporter: Siim Kaalep
>
> ActiveMQConnection.transportInterupted assumes that
> dispatchers.size() == all session's consumers + one advisoryConsumer
> But ActiveMQConnectionConsumer also registers itself as dispatcher in 
> constructor.
> On failover attempt connection will remain in waiting state. 
> Logging "dispatch paused, waiting for outstanding dispatch interruption 
> processing (1) to complete.."
> ActiveMQConnectionConsumer is used in ActiveMQ resource adapter in 
> ActiveMQEndpointWorker.
> Robust fix:
> {noformat} 
> Index: 
> trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
> ===================================================================
> --- 
> trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
> +++ 
> trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
> @@ -1840,7 +1840,7 @@
>       }
>  
>      public void transportInterupted() {
> -        transportInterruptionProcessingComplete = new 
> CountDownLatch(dispatchers.size() - (advisoryConsumer != null ? 1:0));
> +        transportInterruptionProcessingComplete = new 
> CountDownLatch(dispatchers.size() - (advisoryConsumer != null ? 1:0) - 
> connectionConsumers.size());
>          if (LOG.isDebugEnabled()) {
>              LOG.debug("transport interrupted, dispatchers: " + 
> transportInterruptionProcessingComplete.getCount());
>          }
> {noformat} 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to