[
https://issues.apache.org/activemq/browse/AMQNET-152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jim Gomes resolved AMQNET-152.
------------------------------
Resolution: Cannot Reproduce
Using the provided test code, I am unable to reproduce the problem. I am using
the latest build of NMS 1.1, which is Revision 771975. I tested on both .NET
2.0 and Mono 2.2 running on Windows XP and using an ActiveMQ 5.3-SNAPSHOT
broker. I started the test before launching the ActiveMQ broker. Following is
the output from my test run. Based on these results, whatever what wrong
before has been fixed:
\\
{panel:title="IssueExample Output"}
C:\> mono mfail.exe failover:(tcp://activemqhost:61616) test.topic
DEBUG:Reconnect was triggered but transport is not started yet. Wait for start
to connect the transport.
DEBUG:Started.
DEBUG:Creating reconnect task
DEBUG:Waking up reconnect task
DEBUG:Attempting connect to: tcp://activemqhost:61616/
DEBUG:Opening socket to: activemqhost on port: 61616
DEBUG:Connect fail to: tcp://activemqhost:61616/, reason: The operation
completed successfully.
DEBUG:Waiting 10ms before attempting connection.
INFO:Waiting for transport to reconnect.
DEBUG:Attempting connect to: tcp://activemqhost:61616/
DEBUG:Opening socket to: activemqhost on port: 61616
DEBUG:Connect fail to: tcp://activemqhost:61616/, reason: The operation
completed successfully.
INFO:Waiting for transport to reconnect.
DEBUG:Waiting 20ms before attempting connection.
DEBUG:Attempting connect to: tcp://activemqhost:61616/
DEBUG:Opening socket to: activemqhost on port: 61616
DEBUG:Connect fail to: tcp://activemqhost:61616/, reason: The operation
completed successfully.
INFO:Waiting for transport to reconnect.
DEBUG:Waiting 40ms before attempting connection.
DEBUG:Attempting connect to: tcp://activemqhost:61616/
DEBUG:Opening socket to: activemqhost on port: 61616
DEBUG:Connect fail to: tcp://activemqhost:61616/, reason: The operation
completed successfully.
INFO:Waiting for transport to reconnect.
DEBUG:Waiting 80ms before attempting connection.
DEBUG:Attempting connect to: tcp://activemqhost:61616/
DEBUG:Opening socket to: activemqhost on port: 61616
DEBUG:Connected to activemqhost:61616 using activemqhost protocol.
DEBUG:Parsing type: 1 with:
Apache.NMS.ActiveMQ.OpenWire.V1.WireFormatInfoMarshaller
DEBUG:Connection established
INFO:Successfully connected to: tcp://activemqhost:61616/
DEBUG:Parsing type: 2 with: Apache.NMS.ActiveMQ.OpenWire.V2.BrokerInfoMarshaller
DEBUG:Parsing type: 30 with: Apache.NMS.ActiveMQ.OpenWire.V2.ResponseMarshaller
DEBUG:Parsing type: 30 with: Apache.NMS.ActiveMQ.OpenWire.V2.ResponseMarshaller
DEBUG:Parsing type: 30 with: Apache.NMS.ActiveMQ.OpenWire.V2.ResponseMarshaller
DEBUG:Parsing type: 30 with: Apache.NMS.ActiveMQ.OpenWire.V2.ResponseMarshaller
INFO:Starting dispatcher thread for session
INFO:Starting dispatcher thread for session
INFO:Dispatcher thread started
INFO:Dispatcher thread started
Successfully connected to Topic 'test.topic' on
'failover:(tcp://activemqhost:61616)' - waiting Any Key to be pressed
INFO:Stopping dispatcher thread for session
INFO:Dispatcher thread stopped
INFO:Dispatcher thread joined
INFO:Stopping dispatcher thread for session
INFO:Dispatcher thread stopped
INFO:Dispatcher thread joined
Connected and Disconnected successfully toTopic 'test.topic' on
'failover:(tcp://activemqhost:61616)' - Press any key to terminate
program.{panel}
> Infinit exception at reconnect on Mono with failover transport.
> ---------------------------------------------------------------
>
> Key: AMQNET-152
> URL: https://issues.apache.org/activemq/browse/AMQNET-152
> Project: ActiveMQ .Net
> Issue Type: Bug
> Components: ActiveMQ Client
> Environment: Mono 1.9.1 framework on both Windows/Linux system.
> Reporter: Tomasz Wiczling
> Assignee: Jim Gomes
> Fix For: 1.1
>
>
> I'm testing failover transport on Mono.
> I've downloaded latest revision of ActiveMQ .Net project (rev. 752559).
> I've made tests on:
> - both Windows and Linux
> - Mono 1.9.1 and Mono 2.0
> - ActiveMQ 5.1 and ActiveMQ 5.2
> All test ended with an exception.
> I wrote simple program that was listening on topic.
> namespace IssueExample
> {
> internal class ConsoleTracer : ITrace
> {
> public bool IsDebugEnabled { get { return true; } }
> public bool IsInfoEnabled { get { return true; } }
> public bool IsWarnEnabled { get { return true; } }
> public bool IsErrorEnabled { get { return true; } }
> public bool IsFatalEnabled { get { return true; } }
> public void Debug(string message) {
> Console.WriteLine("DEBUG:" + message); }
> public void Info(string message) { Console.WriteLine("INFO:"
> + message); }
> public void Warn(string message) { Console.WriteLine("WARN:"
> + message); }
> public void Error(string message) {
> Console.WriteLine("ERROR:" + message); }
> public void Fatal(string message) {
> Console.WriteLine("FATAL:" + message); }
> }
> class Program
> {
> public static void Main(string[] args)
> {
> if (args.Length < 2)
> {
> Console.WriteLine("USAGE: IssueExample
> <AMQURI> <TOPIC_NAME>");
> return;
> }
> Tracer.Trace = new ConsoleTracer();
> IConnectionFactory factory = new
> ConnectionFactory(args[0]);
> IConnection connection = factory.CreateConnection();
> ISession session = connection.CreateSession();
> IDestination destination = session.GetTopic(args[1]);
> IMessageConsumer consumer =
> session.CreateConsumer(destination);
> consumer.Listener += onMessage;
> connection.Start();
> Console.WriteLine("Successfully connected to Topic '"
> + args[1] + "' on '" + args[0] + "' - waiting Any Key to be pressed");
> Console.ReadKey();
> consumer.Close();
> connection.Dispose();
> Console.WriteLine("Connected and Disconnected
> successfully toTopic '" + args[1] + "' on '" + args[0] + "' - Press any key
> to terminate program.");
> Console.ReadKey();
> }
> private static void onMessage(IMessage msg)
> {
> Console.WriteLine("\tRECEIVING: " + msg);
> }
> }
> }
> The test was made with execution:
> # mono IssueExample.exe failover:(tcp://localhost:61616) test.topic
> Program works fine till the test of reconnection.
> While the program is running I restart the AMQ server.
> For a while I get loop of:
> (...)
> DEBUG:Waiting 1280 ms before attempting connection.
> DEBUG:Attempting connect to: tcp://localhost:61616/
> DEBUG:Opening socket to: localhost on port: 61616
> DEBUG:Connect fail to: tcp://localhost:61616/, reason:
> System.Net.Sockets.SocketException: Connection refused
> at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remote_end)
> [0x00000]
> at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.Connect
> (System.String host, Int32 port) [0x00000]
> at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransportFactory.CompositeConnect
> (System.Uri location) [0x00000]
> at Apache.NMS.ActiveMQ.Transport.TransportFactory.CompositeConnect
> (System.Uri location) [0x00000]
> at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect ()
> [0x00000]
> (...)
> And it is OK, but ...
> When server resumes work, I get:
> (...)
> DEBUG:Waiting 20480 ms before attempting connection.
> DEBUG:Parsing type: 2 with:
> Apache.NMS.ActiveMQ.OpenWire.V2.BrokerInfoMarshaller
> DEBUG:Parsing type: 30 with:
> Apache.NMS.ActiveMQ.OpenWire.V2.ResponseMarshaller
> ERROR:Unknown response ID: 0 for response: Response[ CorrelationId=1 ]
> DEBUG:Parsing type: 10 with:
> Apache.NMS.ActiveMQ.OpenWire.V2.KeepAliveInfoMarshaller
> INFO:Keep alive message received.
> INFO:Waiting for transport to reconnect.
> DEBUG:Attempting connect to: tcp://localhost:61616/
> DEBUG:Opening socket to: localhost on port: 61616
> DEBUG:Parsing type: 1 with:
> Apache.NMS.ActiveMQ.OpenWire.V1.WireFormatInfoMarshaller
> DEBUG:Connect fail to: tcp://localhost:61616/, reason:
> System.InvalidCastException: Cannot cast from source type to destination type.
> at
> System.Collections.Generic.Dictionary`2+ValueCollection[Apache.NMS.ActiveMQ.Commands.SessionId,Apache.NMS.ActiveMQ.State.SessionState].System.Collections.ICollection.CopyTo
> (System.Array array, Int32 index) [0x00000]
> at System.Collections.ArrayList.InsertRange (Int32 index, ICollection c)
> [0x00000]
> at System.Collections.ArrayList.AddRange (ICollection c) [0x00000]
> at System.Collections.ArrayList..ctor (ICollection c) [0x00000]
> at
> Apache.NMS.ActiveMQ.State.SynchronizedCollection`1[Apache.NMS.ActiveMQ.State.SessionState]..ctor
> (ICollection c) [0x00000]
> at
> Apache.NMS.ActiveMQ.State.SynchronizedDictionary`2[Apache.NMS.ActiveMQ.Commands.SessionId,Apache.NMS.ActiveMQ.State.SessionState].get_Values
> () [0x00000]
> at Apache.NMS.ActiveMQ.State.ConnectionState.get_SessionStates () [0x00000]
> at Apache.NMS.ActiveMQ.State.ConnectionStateTracker.DoRestoreSessions
> (ITransport transport, Apache.NMS.ActiveMQ.State.ConnectionState
> connectionState) [0x00000]
> at Apache.NMS.ActiveMQ.State.ConnectionStateTracker.DoRestore (ITransport
> transport) [0x00000]
> at
> Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.restoreTransport
> (ITransport t) [0x00000]
> at Apache.NMS.ActiveMQ.Transport.Failover.FailoverTransport.doReconnect ()
> [0x00000]
> (...)
> And this is permanent state.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.