Adel Boutros created QPIDJMS-154:
------------------------------------
Summary: Failover mechanism does not handle connection URLs in a
predictable way
Key: QPIDJMS-154
URL: https://issues.apache.org/jira/browse/QPIDJMS-154
Project: Qpid JMS
Issue Type: Bug
Components: qpid-jms-client
Affects Versions: 0.8.0
Reporter: Adel Boutros
As discussed in this
[link|http://qpid.2158936.n2.nabble.com/Unhandled-exception-when-using-High-Availabilty-in-Qpid-Java-Broker-6-0-0-td7639896.html],
if the links provided in the failover URL are ordered in a way to have the
Replicate first and then the Master. Then the connection will fail and an error
will be thrown client-side.
This is because the multi-threading behavior in the FailoverProvider is not
correct. The main thread will not wait for the connection trial thread to try
and find the active Master node. If we add a Sleep or debug the main thread to
give the connection trial thread enough time to find the Master URL then the
test works
*_Log in case of failure:_*
{code}
2016-03-11 10:46:31 DEBUG FailoverProvider:160 - Initiating initial connection
attempt task
2016-03-11 10:46:33 DEBUG FailoverProvider:653 - Connection attempt:[1] to:
amqp://localhost:10352?amqp.vhost=weather in-progress
2016-03-11 10:46:34 DEBUG FailoverProvider:963 - Executing Failover Task:
create -> JmsConnectionInfo {} (1)
2016-03-11 10:46:34 DEBUG FailoverProvider:761 - Failover: the provider reports
failure: Received error from remote peer without description [condition =
amqp:not-found]
2016-03-11 10:46:34 DEBUG FailoverProvider:519 - handling Provider failure:
Received error from remote peer without description [condition = amqp:not-found]
2016-03-11 10:46:34 DEBUG FailoverProvider:653 - Connection attempt:[1] to:
amqp://localhost:5672?amqp.vhost=weather in-progress
2016-03-11 10:46:31 DEBUG FailoverProvider:160 - Initiating initial connection
attempt task
2016-03-11 10:46:33 DEBUG FailoverProvider:653 - Connection attempt:[1] to:
amqp://localhost:10352?amqp.vhost=weather in-progress
2016-03-11 10:46:34 DEBUG FailoverProvider:963 - Executing Failover Task:
create -> JmsConnectionInfo {} (1)
2016-03-11 10:46:34 DEBUG FailoverProvider:761 - Failover: the provider reports
failure: Received error from remote peer without description [condition =
amqp:not-found]
2016-03-11 10:46:34 DEBUG FailoverProvider:519 - handling Provider failure:
Received error from remote peer without description [condition = amqp:not-found]
2016-03-11 10:46:34 DEBUG FailoverProvider:653 - Connection attempt:[1] to:
amqp://localhost:5672?amqp.vhost=weather in-progress
{code}
*_Logs in case we debug the main thread to allow the connection thread to
finish:_*
{code}
2016-03-11 11:03:37 DEBUG FailoverProvider:160 - Initiating initial connection
attempt task
2016-03-11 11:04:05 DEBUG FailoverProvider:653 - Connection attempt:[1] to:
amqp://localhost:10352?amqp.vhost=weather in-progress
2016-03-11 11:04:18 DEBUG FailoverProvider:963 - Executing Failover Task:
create -> JmsConnectionInfo {} (1)
2016-03-11 11:04:18 DEBUG FailoverProvider:985 - Request received error: Cannot
send to a non-connected transport.
2016-03-11 11:04:18 DEBUG FailoverProvider:519 - handling Provider failure:
Cannot send to a non-connected transport.
2016-03-11 11:04:18 DEBUG FailoverProvider:985 - Request received error: Cannot
send to a non-connected transport.
2016-03-11 11:04:18 DEBUG FailoverProvider:761 - Failover: the provider reports
failure: Cannot send to a non-connected transport.
2016-03-11 11:04:18 DEBUG FailoverProvider:519 - handling Provider failure:
Cannot send to a non-connected transport.
2016-03-11 11:04:18 DEBUG FailoverProvider:519 - handling Provider failure:
Cannot send to a non-connected transport.
2016-03-11 11:04:40 DEBUG FailoverProvider:653 - Connection attempt:[1] to:
amqp://localhost:5672?amqp.vhost=weather in-progress
2016-03-11 11:04:41 DEBUG FailoverProvider:963 - Executing Failover Task:
create -> JmsConnectionInfo {} (1)
2016-03-11 11:04:42 INFO JmsConnection:1114 - Connection
ID::af28891b-adbe-47f1-9da2-ad03f124a215:1 connected to remote Broker:
amqp://localhost:5672
2016-03-11 11:04:42 DEBUG FailoverProvider:963 - Executing Failover Task:
create -> JmsSessionInfo {} (2)
{code}
*_Test code:_*
{code:java}
@Test
public void testScalabilityReversedOrder() throws JMSException {
String brokerUrl =
"failover:(amqp://localhost:10352,amqp://localhost:5672)?failover.nested.amqp.vhost=weather";
ConnectionFactory connectionFactory = new JmsConnectionFactory(brokerUrl);
Connection connection = connectionFactory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]