racorn edited a comment on issue #8056:
URL: https://github.com/apache/pulsar/issues/8056#issuecomment-692306010


   @rdhabalia
   
   The behavior you describe is what I thought was expected. But, the method 
createConnection is invoked with the broker host, then invokes 
connectToResolvedAddresses which in turn invokes connectToAddress where the 
broker address is set as the SNI host and the proxy URL host is connected to 
instead.
   
   I suggest that in createConnection InetAddress.getByName is replaced with 
the parameter 'unresolvedAddress'.
   
   Anyway, here is a stacktrace
   
   ERROR: 2020-09-14 22:29:03.218 [pulsar-client-io-1-2] [ConnectionPool] - 
Invalid remote url pulsar-3-fra1.internal.mycompany.com
   java.net.UnknownHostException: No such host is known 
(pulsar-3-fra1.internal.mycompany.com)                at 
java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)            
    at 
java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929)
                at 
java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1515)
                at 
java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848)   
             at 
java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1505)             
   at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1364)        
        at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1298)   
             at java.base/java.net.InetAddress.getByName(InetAddress.java:1248) 
               at org.apache.pulsar.cl
 ient.impl.ConnectionPool.createConnection(ConnectionPool.java:231)             
   at 
org.apache.pulsar.client.impl.ConnectionPool.createConnection(ConnectionPool.java:166)
                at 
org.apache.pulsar.client.impl.ConnectionPool.lambda$getConnection$4(ConnectionPool.java:154)
                at 
java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
                at 
org.apache.pulsar.client.impl.ConnectionPool.getConnection(ConnectionPool.java:154)
                at 
org.apache.pulsar.client.impl.ConnectionPool.getConnection(ConnectionPool.java:105)
                at 
org.apache.pulsar.client.impl.BinaryProtoLookupService.findBroker(BinaryProtoLookupService.java:110)
                at 
org.apache.pulsar.client.impl.BinaryProtoLookupService.lambda$null$2(BinaryProtoLookupService.java:128)
                at java.base/java.util
 .concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714)    
            at 
java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
                at 
java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)
                at 
org.apache.pulsar.client.impl.ClientCnx.handleLookupResponse(ClientCnx.java:481)
                at 
org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:131)
                at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
                at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
                at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
                at io
 
.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:321)
                at 
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:295)
                at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
                at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
                at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
                at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1486) 
               at 
io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1235)       
         at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1282)        
        at io.netty.handler.codec.ByteToMessageDecoder.deco
 deRemovalReentryProtection(ByteToMessageDecoder.java:498)                at 
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:437)
                at 
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
                at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
                at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
                at 
io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
                at 
io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
                at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
          
       at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
                at 
io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
                at 
io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
                at 
io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)     
           at 
io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
                at 
io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)    
            at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)     
           at 
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
                at io.netty.util.internal.ThreadExecuto
 rMap$2.run(ThreadExecutorMap.java:74)                at 
io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
                at java.base/java.lang.Thread.run(Thread.java:834)Thanks14. 
sep. 2020 21:28 skrev Rajan Dhabalia <[email protected]>:
   @racorn
   
   As the resolved hostname is only used as the value of the SNI header field, 
and not for the TCP-connection (the client connects to the host given in 
ProxyUrl), I wonder if it should be required that the 'internal hosts' must be 
resolvable to the client?
   
   In SNI-reverse-Proxy, pulsar-client always connects to the proxy-host and 
passes the pulsar-url as part of SNI header without trying to resolve pulsar 
broker hosts. Proxy-host which supports SNI-routing , gets the target 
broker-service-url from SNI and creates proxy between pulsar-client and 
pulsar-server. Therefore, Pulsar client can only resolve proxy host and client 
can't resolve any broker hosts. so, pulsar-client does not try to resolve 
broker-host and passes it to proxy in SNI header without resolving the address.
   Can you share the stacktrace for your issue? Pulsar client only tries to 
resolve proxy host so, can you check if you can resolve porxy-host from the 
client?
   
   —You are receiving this because you were mentioned.Reply to this email 
directly, view it on GitHub, or unsubscribe.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to