OK, based on everything you just tested, it sounds like the problem is in the ActiveMQ client code (either in the failover transport itself or maybe somewhere else that's not hit when using the raw TCP transport). My best guess at the moment is that we're somehow getting stuck (waiting for a lock, in a loop, etc) that prevents us from making the tcp://host2:61616 connection, but that's just a guess.
Can you please re-run test 2 and take (and post here) a thread dump of the client process so we can see where the thread is, to see if that supports the theory of getting stuck? Tim On Jul 25, 2017 12:33 AM, "akpuvvada" <[email protected]> wrote: > Hi Tim, > Please find below the observations. > > > > 1. Kill host1 so host2 becomes the master and there is no slave. Connect a > consumer with a URI of tcp://host1:61616. Does it connect? What's in the > consumer's logs? > > ActiveMQConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://potaplq00001la:61616"); > Jul 25, 2017 11:45:34 AM > activemqjmsclients.FTTest.ActiveMQJMSClients_Producer run > SEVERE: null > javax.jms.JMSException: Could not connect to broker URL: > tcp://potaplq00001la:61616. Reason: java.net.ConnectException: Connection > refused: connect > at > org.apache.activemq.util.JMSExceptionSupport.create( > JMSExceptionSupport.java:36) > at > org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection( > ActiveMQConnectionFactory.java:374) > at > org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection( > ActiveMQConnectionFactory.java:304) > at > org.apache.activemq.ActiveMQConnectionFactory.createConnection( > ActiveMQConnectionFactory.java:244) > at > activemqjmsclients.FTTest.ActiveMQJMSClients_Producer. > run(ActiveMQJMSClients_Producer.java:53) > at java.lang.Thread.run(Thread.java:745) > Caused by: java.net.ConnectException: Connection refused: connect > at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) > at > java.net.DualStackPlainSocketImpl.socketConnect( > DualStackPlainSocketImpl.java:85) > at > java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java: > 345) > at > java.net.AbstractPlainSocketImpl.connectToAddress( > AbstractPlainSocketImpl.java:206) > at > java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) > at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) > at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) > at java.net.Socket.connect(Socket.java:589) > at > org.apache.activemq.transport.tcp.TcpTransport.connect( > TcpTransport.java:525) > at > org.apache.activemq.transport.tcp.TcpTransport.doStart( > TcpTransport.java:488) > at org.apache.activemq.util.ServiceSupport.start( > ServiceSupport.java:55) > at > org.apache.activemq.transport.AbstractInactivityMonitor.start( > AbstractInactivityMonitor.java:169) > at > org.apache.activemq.transport.InactivityMonitor.start( > InactivityMonitor.java:52) > at > org.apache.activemq.transport.TransportFilter.start( > TransportFilter.java:64) > at > org.apache.activemq.transport.WireFormatNegotiator.start( > WireFormatNegotiator.java:72) > at > org.apache.activemq.transport.TransportFilter.start( > TransportFilter.java:64) > at > org.apache.activemq.transport.TransportFilter.start( > TransportFilter.java:64) > at > org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection( > ActiveMQConnectionFactory.java:354) > ... 4 more > > Exception in thread "Thread-1" java.lang.NullPointerException > at > activemqjmsclients.FTTest.ActiveMQJMSClients_Producer. > run(ActiveMQJMSClients_Producer.java:91) > at java.lang.Thread.run(Thread.java:745) > > ------------------------------------------------------------ > ------------------------------------------------------------ > ------------------- > 2. Kill host1 so host2 becomes the master and there is no slave. Connect a > consumer with your normal failover URI. Does it connect? What's in the > consumer's logs? > > ActiveMQConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("failover:(tcp://potaplq00001la:61616,tcp:/ > potaplq00001lb:61616)"); > > Just hung/waiting for more than 5 mnts and then I killed the code manually. > No entries in logs. > > ------------------------------------------------------------ > ------------------------------------------------------------ > ------------------- > 3. Kill host1 so host2 becomes the master and there is no slave. Start > host1 so it becomes the slave. Kill host2 so host1 becomes the master and > there is no slave. Connect a consumer with your normal failover URI. Does > it connect? What's in the consumer's logs? > > ActiveMQConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("failover:(tcp://potaplq00001la:61616,tcp:/ > potaplq00001lb:61616)"); > > > It is connecting without any issues. > ------------------------------------------------------------ > ------------------------------------------------------------ > ------------------- > 4. Remove the timeout attribute from your failover URI and try your > "regular" test again. You never mentioned that you were providing > additional options (randomize and timeout) to the failover URI, neither > here nor in the JIRA bug you submitted. > > I only used them yesterday. I tested the above scenarios without the > options. > > > > > -- > View this message in context: http://activemq.2283324.n4. > nabble.com/Active-MQ-Master-Slave-Config-Not-working- > tp4728550p4728862.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. >
