[ 
https://issues.apache.org/jira/browse/AMQ-9438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17821894#comment-17821894
 ] 

George McCone commented on AMQ-9438:
------------------------------------

Thank you for the response, I feel silly for not checking the inheritance of 
UnknownHostException and see now that the IOException is catching the error and 
reporting it. I updated the exception log in the description that does show the 
the LOG.error message. 

I guess the question at this point is if the compareURIs should be reporting a 
stack trace in this case? This error fills our log as we have some brokers that 
are dynamically added and removed from the environment while a client is up. A 
lot of noise in the log for what we consider nominal. We configure many 
failover brokers for the client and as load increases, new brokers are brought 
in to distribute the load and then when the load reduces we shut those brokers 
down to save costs.

> FailoverTransport throws UnknowHostException on compareURIs
> -----------------------------------------------------------
>
>                 Key: AMQ-9438
>                 URL: https://issues.apache.org/jira/browse/AMQ-9438
>             Project: ActiveMQ Classic
>          Issue Type: Improvement
>          Components: Transport
>    Affects Versions: 5.18.3, 5.17.6, 5.16.7
>         Environment: This occurs using OpenJDK 11 on both Windows and Linux 
> environments.
>            Reporter: George McCone
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>
> In the 
> org.apache.activemq.transport.failover.FailoverTransport.compareURIs(), it is 
> trying to compare 2 hosts to see if they are the same.
> To accomplish this, the function InetAddress.getByName() used to help extract 
> out the the IP address of each of the hosts to see if they are the same.
> In the event one of the hosts is not resolvable,  InetAddress.getByName() 
> throws a UnknownHostException.
> This UnknownHostException is not being caught in the try/catch block, only 
> IOException.
> I believe the exception catch block should be extended to catch 
> UnknownHostException as it is simply doing a string compare that the 2 hosts 
> are the same at that point.
> For example, in the stacktrace below the uri was, 
> failover:(tcp://UNKNOWN:61616,tcp://AMQ1:61616)?randomize=false/org.apache.activemq.jndi.ActiveMQInitialContextFactory/ConnectionFactory
> {code:java}
> 2024-02-27T19:37:20,311 | ERROR | FelixStartLevel  | FailoverTransport        
>         | 28 - org.apache.activemq.osgi - 5.18.3 | Failed to Lookup 
> INetAddress for URI[tcp://UNKNOWN:61616] : {}
> java.net.UnknownHostException: No such host is known (UNKNOWN)
>     at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[?:?]
>     at 
> java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929)
>  ~[?:?]
>     at 
> java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1519) ~[?:?]
>     at java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848) 
> ~[?:?]
>     at java.net.InetAddress.getAllByName0(InetAddress.java:1509) ~[?:?]
>     at java.net.InetAddress.getAllByName(InetAddress.java:1368) ~[?:?]
>     at java.net.InetAddress.getAllByName(InetAddress.java:1302) ~[?:?]
>     at java.net.InetAddress.getByName(InetAddress.java:1252) ~[?:?]
>     at 
> org.apache.activemq.transport.failover.FailoverTransport.compareURIs(FailoverTransport.java:1393)
>  ~[?:?] {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to