You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Michel Van Hoof (JIRA)" <ji...@apache.org> on 2009/05/06 21:19:38 UTC

[jira] Created: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Connecting to non-existing host does not raise Exception when using failover protocol
-------------------------------------------------------------------------------------

                 Key: AMQNET-160
                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
             Project: ActiveMQ .Net
          Issue Type: Bug
          Components: ActiveMQ Client
    Affects Versions: 1.0
         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
            Reporter: Michel Van Hoof
            Assignee: Jim Gomes


When using the failover protocol, there is no exception raised when trying to connect to non-existing host.

Example:

using System;
using System.Collections.Generic;
using System.Text;
using Apache.NMS;
using Apache.NMS.ActiveMQ;


    class ExceptionTest
    {
        private readonly IConnectionFactory oConnfact;
        private readonly IConnection oConn;
        private readonly ISession oSess;
        private readonly IMessageConsumer oConsumer;
        private string sConnectionUri = "failover:(tcp://unknownhost:61612)";

        // Using this connectionstring it does fail.

        //private string sConnectionUri = "tcp://unknownhost:61612";

        public ExceptionTest()
        {
            oConn.ExceptionListener += new ExceptionListener(OnException);
            this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
           
            oConn.ExceptionListener += new ExceptionListener(OnException);
            this.oConn = oConnfact.CreateConnection();
            oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
            // Code hangs here
            oConn.Start();

            //Rest does not really mather anymore since it hangs
            
        }

        void OnEx(Exception exception)
        {
                throw new Exception("The method or operation is not implemented.");
        }

        public void OnException(Exception ex)
        {
            Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
        }
    }


If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 

It also seems to ignore the RequestTimeout.

This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Resolved: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Jim Gomes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jim Gomes resolved AMQNET-160.
------------------------------

    Resolution: Working as Designed

In this scenario, the failover protocol is working as designed.  The non-existent server could very well have been a server that failed, and the client is waiting for it to come back up.  While the server is being repaired, it will appear to be "non-existent".  However, an exception should not be thrown.  The failover logic should be applied.  If there were multiple servers listed in the failover URI, then it would move to the next server in the list and an exception should not be thrown.  Since an exception is thrown when not using failover, then this is working correctly.  If the server that is being attempted to be connected to truly does not exist, then this would be considered a configuration error, and not an NMS bug.

> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Reopened: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Jim Gomes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jim Gomes reopened AMQNET-160:
------------------------------


> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Reopened: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish reopened AMQNET-160:
---------------------------------


Implemented solution is no in line with the feature set of the Failover Transport.

> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Commented: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52052#action_52052 ] 

Timothy Bish commented on AMQNET-160:
-------------------------------------

Am understanding this correctly?  You have modified the Failover transport to fail if it can't initially connect to any of its designated hosts when the start method is called?

I'm not sure that's really what you want for a Failover transport.  By changing it to do so you now take away a pretty valuable feature in that the clients are now dependent on the order in which things in the distributed system come up.  So if the Broker is on a server that starts up slowly and I start up the entire system clients and servers I have to ensure that at least one of my servers beats all the clients and gets into a steady state otherwise my clients all fail.  

I think this was really a non issue as you could just set the maxReconnectAttempts property to something other then zero and the transport would eventually give up the connection attempt and throw an exception.

> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Commented: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52061#action_52061 ] 

Timothy Bish commented on AMQNET-160:
-------------------------------------

One thing to note is that just because a host is not known initially it doesn't preclude a DNS update from making that host resolve at a later time, or if running on an isolated system the DNS could be down for some reason.  Kicking out the host from the URIs in the Failover Transport might not really be the best choice here.  I can see rejecting the URI for hostnames that are invalid and wouldn't parse but otherwise I'm not convinced it makes sense to fail because a name can't be resolved at a given time.

> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Commented: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Michel Van Hoof (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52132#action_52132 ] 

Michel Van Hoof commented on AMQNET-160:
----------------------------------------

Well. i can understand your comment on the DNS part although it's doesn't sound 100% logical by me but ok. when AMQNET-159 is fixed, this would resolve on of the most important parts.

For me the solution sounds ok.

> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Commented: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Jim Gomes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52129#action_52129 ] 

Jim Gomes commented on AMQNET-160:
----------------------------------

I'm OK with the backed out changes.  If Michel is OK with this solution, then let's close this issue.  I can see arguments for handling the initial start-up and connection with different client logic than handling a run-time disconnect.  My own application has a design requirement that it not proceed with start-up if it is not connected to the messaging broker.  This is a different scenario than a run-time disconnect that happens to a long-running client connection.  When I issue the Connect() command, and I don't get an exception of some kind, the assumption is that I am actively connected to a broker.  However, with the current solution, this is a bad assumption, but it is only bad if I happen to be using the failover protocol.  Using all other protocols, this is a correct assumption.  The problem here is that my client application does not, and should not, know what protocol is being used, or even what broker I am connecting to (ActiveMQ, vs. TIBCO).  This is an externally configured setting.  I will need to study this further to determine how much of an issue this might be for us.

Regarding Tim's comment above about the DNS resolution issues, I agree with this scenario, which is why I disabled the IPHost caching code.  Previously, the IPHost entries were cached at first look-up for speed considerations.  I realized that with the failover protocol implemented, this could lead to never recognizing that a host has come back online, perhaps with a new dynamic IP address assigned to it.  The code is still there, but just disabled.  I think that code should be looked at further, and perhaps only enabled if failover is not being used.

> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Commented: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52125#action_52125 ] 

Timothy Bish commented on AMQNET-160:
-------------------------------------

I've backed out the changes to the Failover Transport that caused it to throw an exception on start if no connection can be established.

> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Commented: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52130#action_52130 ] 

Timothy Bish commented on AMQNET-160:
-------------------------------------

Agreed.  Thanks for the comments Jim.

To address your case Jim, maybe something we could do is create a separate start-up based failed connections count parameter similar to maxReconnectionAttempts or some such mechanism so that you can attempt a start and still fail after some period if time.  So long as its not making things more confusing having that sort of configuration option might make sense.



> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Resolved: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Jim Gomes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jim Gomes resolved AMQNET-160.
------------------------------

    Resolution: Fixed

Resolving issue as discussed.

> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Commented: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Michel Van Hoof (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52053#action_52053 ] 

Michel Van Hoof commented on AMQNET-160:
----------------------------------------

HI,

I must admit this is a lot further then i actually wanted to take it. My only point was that although the failover protocol should be "up and running" at all times, it might be nice to have it throw some "essential" exceptions for errors that are beyond the failover protocol to solve:

like when dns resolution of a hostname fails, it throws a SocketException: No Such host is known

Since these types of errors would render the failover protocol obsolete anyway, they might be thrown ( no use in failing over and over to a non-existing host OR trying to resolve a hostname when no DNS resolution is possible)

If the failover protocol well.. fails.. just cause it cannot connect to a host which DOES exist but isn't up yet , it indeed would loose it's value ( like Timothy said)

> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Updated: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Jim Gomes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jim Gomes updated AMQNET-160:
-----------------------------

    Fix Version/s: 1.1

> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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


[jira] Resolved: (AMQNET-160) Connecting to non-existing host does not raise Exception when using failover protocol

Posted by "Jim Gomes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jim Gomes resolved AMQNET-160.
------------------------------

    Resolution: Fixed

After further investigating this issue, the code for the failover transport has been re-factored to be more inline with other transports.  If another transport cannot initially connect to a server, an exception is throw (NMSConnectionException).  The failover transport will now also throw this exception when performing the initial connection logic if it is unable to connect to *any* of the servers in the failover list.  Once the transport has successfully connected to at least one of the servers in its list, then it will work in retry mode if that connection goes bad.

Unit tests have been added to test for non-existant servers.

> Connecting to non-existing host does not raise Exception when using failover protocol
> -------------------------------------------------------------------------------------
>
>                 Key: AMQNET-160
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-160
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ Client
>    Affects Versions: 1.0
>         Environment: Windows XP/Windows 2003 , .NET Framework 2.0 (Broker running Ubuntu 8.04 + ActiveMQ 5.2)
>            Reporter: Michel Van Hoof
>            Assignee: Jim Gomes
>             Fix For: 1.1
>
>
> When using the failover protocol, there is no exception raised when trying to connect to non-existing host.
> Example:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
>     class ExceptionTest
>     {
>         private readonly IConnectionFactory oConnfact;
>         private readonly IConnection oConn;
>         private readonly ISession oSess;
>         private readonly IMessageConsumer oConsumer;
>         private string sConnectionUri = "failover:(tcp://unknownhost:61612)";
>         // Using this connectionstring it does fail.
>         //private string sConnectionUri = "tcp://unknownhost:61612";
>         public ExceptionTest()
>         {
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConnfact = new ConnectionFactory(sConnectionUri, "CLIENT.ID");
>            
>             oConn.ExceptionListener += new ExceptionListener(OnException);
>             this.oConn = oConnfact.CreateConnection();
>             oConn.RequestTimeout(new TimeSpan(0, 0, 2)); 
>             // Code hangs here
>             oConn.Start();
>             //Rest does not really mather anymore since it hangs
>             
>         }
>         void OnEx(Exception exception)
>         {
>                 throw new Exception("The method or operation is not implemented.");
>         }
>         public void OnException(Exception ex)
>         {
>             Console.WriteLine("You made a BooBoo: {0} ", ex.ToString());
>         }
>     }
> If you change the connectionstring to "tcp://badhostname:xxxx" , the exception does occur. 
> It also seems to ignore the RequestTimeout.
> This blocks the application thread indefinately since there is no way to recover from it (no exception thrown).

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