feijinsile opened a new issue, #10591:
URL: https://github.com/apache/rocketmq/issues/10591

   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq/discussions).
   
   - [x] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq/discussions)  of this 
repository and believe that this is not a duplicate.
   
   - [x] I have confirmed that this bug belongs to the current repository, not 
other repositories of RocketMQ.
   
   
   ### Runtime platform environment
   
   OS: Centos7.6
   
   ### RocketMQ version
   
   5.3.2
   
   ### JDK Version
   
   1.8
   
   ### Describe the Bug
   
   RocketMQ 5.3.2 在 Proxy 模式下,如果 gRPC Client 使用 IPv6 地址连接 Proxy,发送消息时 Broker 
会抛出 NullPointerException,导致消息发送失败。
   
   经过排查发现,该问题仅在 IPv6 环境下出现,IPv4 环境一切正常。
   
   ### Steps to Reproduce
   
   为了定位问题,我在 Proxy 中增加了一些日志。
   
   gRPC Metadata 中记录的客户端地址如下:
   
   REMOTE_ADDRESS = [240e:341:6246:c700:c4ad:e645:459e:2]:44880
   LOCAL_ADDRESS  = [240e:341:6246:c700:c4ad:e645:459e:2]:8081
   
   随后 ProxyContext 中保存的地址也是:
   
   ProxyContext remote = [240e:341:6246:c700:c4ad:e645:459e:2]:44880
   
   发送消息时:
   
   ctx.remoteAddress = [240e:341:6246:c700:c4ad:e645:459e:2]:44880
   
   说明 gRPC Metadata 在整个 Proxy 内部传递过程中没有发生变化。
   
   ### What Did You Expect to See?
   
   RocketMQ Version:5.3.2
   部署方式:Proxy + Broker + NameServer
   Client:rocketmq-clients-go
   网络环境:IPv6
   我期望发送消息返回正常信息
   
   ### What Did You See Instead?
   
   发送消息后,有异常
   java.lang.NullPointerException: Cannot invoke 
"java.net.InetSocketAddress.getAddress()" because "bornSocketAddress" is null
       at 
org.apache.rocketmq.store.CommitLog.asyncPutMessage(CommitLog.java:945)
       at 
org.apache.rocketmq.store.DefaultMessageStore.asyncPutMessage(DefaultMessageStore.java:602)
       at 
org.apache.rocketmq.broker.processor.SendMessageProcessor.sendMessage(SendMessageProcessor.java:328)
       ...
   
   ### Additional Context
   
   最终定位到:
   org.apache.rocketmq.common.utils.NetworkUtil
   public static SocketAddress string2SocketAddress(final String addr) {
       int split = addr.lastIndexOf(":");
       String host = addr.substring(0, split);
       String port = addr.substring(split + 1);
       return new InetSocketAddress(host, Integer.parseInt(port));
   }
   Proxy 将 gRPC Metadata 中的
   [240e:341:6246:c700:c4ad:e645:459e:2]:44880
   转换为:
   new InetSocketAddress(
       "[240e:341:6246:c700:c4ad:e645:459e:2]",
       44880
   )
   随后:ctx.channel().remoteAddress()
   最终成为:InetSocketAddress
   但是其中:inetSocketAddress.getAddress()
   返回为:null
   最终在 CommitLog 中:bornSocketAddress.getAddress()
   触发 NullPointerException。


-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to