Hello,

When we provide a failover URL where the first URL is that of a replicate
broker, the connection will trigger an IllegalStateException which is not
caught anywhere. Thus making the broker crash and the session creation fail
on the client-side.

Shouldn't the "close" method log the exception silently instead of crashing
the broker?

*Code*

String brokerUrl = "failover:(amqp://localhost:5672,amqp://localhost:10352)";
ConnectionFactory connectionFactory = new JmsConnectionFactory(brokerUrl);
Connection connection = connectionFactory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

*Test case*
Assuming that the broker on *localhost:5672 *is alive but as a *REPLICATE*
and the one on* localhost:10352* as the *MASTER*

*Stack trace*
java.lang.IllegalStateException: The virtual host state of UNAVAILABLE does
not permit this operation.
        at
org.apache.qpid.server.virtualhost.berkeleydb.BDBHAReplicaVirtualHostImpl.throwUnsupportedForReplica(BDBHAReplicaVirtualHostImpl.java:567)
        at
org.apache.qpid.server.virtualhost.berkeleydb.BDBHAReplicaVirtualHostImpl.deregisterConnection(BDBHAReplicaVirtualHostImpl.java:562)
        at
org.apache.qpid.server.protocol.v1_0.Connection_1_0.closed(Connection_1_0.java:282)
        at
org.apache.qpid.server.protocol.v1_0.AMQPConnection_1_0.closed(AMQPConnection_1_0.java:470)
        at
org.apache.qpid.server.transport.MultiVersionProtocolEngine.closed(MultiVersionProtocolEngine.java:112)
        at
org.apache.qpid.server.transport.NonBlockingConnection.shutdown(NonBlockingConnection.java:359)
        at
org.apache.qpid.server.transport.NonBlockingConnection.doWork(NonBlockingConnection.java:299)
        at
org.apache.qpid.server.transport.NetworkConnectionScheduler.processConnection(NetworkConnectionScheduler.java:108)
        at
org.apache.qpid.server.transport.SelectorThread$ConnectionProcessor.processConnection(SelectorThread.java:499)
        at
org.apache.qpid.server.transport.SelectorThread$SelectionTask.performSelect(SelectorThread.java:337)
        at
org.apache.qpid.server.transport.SelectorThread$SelectionTask.run(SelectorThread.java:86)
        at
org.apache.qpid.server.transport.SelectorThread.run(SelectorThread.java:457)
        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:744)

If you invert the order of the URLs to put the master first or simply kill
the REPLICATE broker, then there will be no exception triggered.

Regards,
Adel Boutros

Reply via email to