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

Justin Bertram commented on ARTEMIS-3676:
-----------------------------------------

The code you're referencing in 
{{org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector#createConnection}}
 is in the latest version and has been there since the 1.0.0 release so it's 
not the root cause of the issue.

How is 2.16.0 handling this as a transient connection error and 2.19.1 is not? 
The exception is coming from the socket provided by the JVM to Netty. There's 
nothing the client can really do with it except retry the connection attempt. 
Have you set {{initialConnectAttempts}} on your client?

> "No route to host" exceptions from Netty
> ----------------------------------------
>
>                 Key: ARTEMIS-3676
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3676
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 2.19.1
>            Reporter: Apache Dev
>            Priority: Minor
>
> The following exception is logged when client transport connector is 
> configured with broker hosts currently not available. For example, when 
> configured host is down, which is a situation possible in a container 
> environment:
> {code}
> [2/8/22 15:31:31:678 CET] 00000101 org.apache.activemq.artemis.core.client    
>                   E AMQ214016: Failed to create netty connection
> io.netty.channel.AbstractChannel$AnnotatedNoRouteToHostException: No route to 
> host: activemq2/172.10.0.52:61617
> Caused by: java.net.NoRouteToHostException: No route to host
>       at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
>       at 
> sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:716)
>       at 
> io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:330)
>       at 
> io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
>       at 
> io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:710)
>       at 
> io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
>       at 
> io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
>       at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
>       at 
> io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
>       at 
> io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
>       at 
> org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)
> {code}
>  
> Artemis 2.16 did not log such exceptions (they were handled as transient 
> connection errors).
> Artemis intercepts Netty exception in 
> {{org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector#createConnection(java.util.function.Consumer<io.netty.channel.ChannelFuture>,
>  java.lang.String, int)}}
> and logs it as an error because it is not a ConnectException:
> {code}
>          if (t != null && !(t instanceof ConnectException)) {
>             
> ActiveMQClientLogger.LOGGER.errorCreatingNettyConnection(future.cause());
>          }
> {code}
> I think it should be handled like a transient connection error, similar to 
> what happens when host machine is up and running but broker is not active.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to