You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "beijixing1745 (via GitHub)" <gi...@apache.org> on 2023/04/07 02:21:01 UTC

[GitHub] [rocketmq] beijixing1745 opened a new issue, #6546: win10 mqadmin statsAll -n 10.0.24.108:9876 StatsAllSubCommand command failed

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

   **BUG REPORT**
   
   1. operate detail :
   
   win10 内存 32G rocketmq 4.9.4、4.9.5都有问题
   (1)set env
   set NAMESRV_ADDR=10.0.24.108:9876
   set JAVA_HOME=C:\language\java\jdk1.8.0_251
   set ROCKETMQ_HOME=D:\work\server\queue\rocketmq-all-4.9.5-bin-release
   (2)启动 mqnamesrv.cmd,mqbroker.cmd
   mqnamesrv.cmd
   Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release
   Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
   The Name Server boot success. serializeType=JSON
   
   mqbroker.cmd -n 10.0.24.108:9876 autoCreateTopicEnable=true -c ../conf/broker.conf
   The broker[broker-a, 10.0.24.108:10911] boot success. serializeType=JSON and name server is 10.0.24.108:9876
   
   (3)本机执行 mqadmin statsAll -n 10.0.24.108:9876
   mqadmin statsAll -n 10.0.24.108:9876
   org.apache.rocketmq.tools.command.SubCommandException: StatsAllSubCommand command failed
           at org.apache.rocketmq.tools.command.stats.StatsAllSubCommand.execute(StatsAllSubCommand.java:202)
           at org.apache.rocketmq.tools.command.MQAdminStartup.main0(MQAdminStartup.java:149)
           at org.apache.rocketmq.tools.command.MQAdminStartup.main(MQAdminStartup.java:100)
   Caused by: org.apache.rocketmq.remoting.exception.RemotingConnectException: connect to [10.0.24.108:9876] failed
           at org.apache.rocketmq.remoting.netty.NettyRemotingClient.getAndCreateNameserverChannel(NettyRemotingClient.java:458)
           at org.apache.rocketmq.remoting.netty.NettyRemotingClient.getAndCreateChannel(NettyRemotingClient.java:413)
           at org.apache.rocketmq.remoting.netty.NettyRemotingClient.invokeSync(NettyRemotingClient.java:382)
           at org.apache.rocketmq.client.impl.MQClientAPIImpl.getTopicListFromNameServer(MQClientAPIImpl.java:1426)
           at org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl.fetchAllTopicList(DefaultMQAdminExtImpl.java:280)
           at org.apache.rocketmq.tools.admin.DefaultMQAdminExt.fetchAllTopicList(DefaultMQAdminExt.java:231)
           at org.apache.rocketmq.tools.command.stats.StatsAllSubCommand.execute(StatsAllSubCommand.java:172)
           ... 2 more
   
   
   3. 同样版本4.9.4在有的机器没有问题,参考 https://github.com/apache/rocketmq/pull/6279/files:
   用4.9.4的源码调试 org.apache.rocketmq.remoting.netty.NettyRemotingClient,函数invokeSync
   
   修改内容
   
   ```
   public RemotingCommand invokeSync(String addr, final RemotingCommand request, long timeoutMillis)
           throws InterruptedException, RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException {
   。。。。。。
    final Channel channel = this.getAndCreateChannel(addr);
   String channelRemoteAddr = RemotingHelper.parseChannelRemoteAddr(channel);
   。。。。。。
     doBeforeRpcHooks(channelRemoteAddr, request);
   。。。。。。
   doAfterRpcHooks(channelRemoteAddr, request, response);
   ```
   
   函数修改后
   ```
   public RemotingCommand invokeSync(String addr, final RemotingCommand request, long timeoutMillis)
           throws InterruptedException, RemotingConnectException, RemotingSendRequestException, RemotingTimeoutException {
           long beginStartTime = System.currentTimeMillis();
           final Channel channel = this.getAndCreateChannel(addr);
           String channelRemoteAddr = RemotingHelper.parseChannelRemoteAddr(channel);
           if (channel != null && channel.isActive()) {
               try {
                   doBeforeRpcHooks(channelRemoteAddr, request);
                   long costTime = System.currentTimeMillis() - beginStartTime;
                   if (timeoutMillis < costTime) {
                       throw new RemotingTimeoutException("invokeSync call the addr[" + addr + "] timeout");
                   }
                   RemotingCommand response = this.invokeSyncImpl(channel, request, timeoutMillis - costTime);
                   doAfterRpcHooks(channelRemoteAddr, request, response);
                   return response;
               } catch (RemotingSendRequestException e) {
                   log.warn("invokeSync: send request exception, so close the channel[{}]", addr);
                   this.closeChannel(addr, channel);
                   throw e;
               } catch (RemotingTimeoutException e) {
                   if (nettyClientConfig.isClientCloseSocketIfTimeout()) {
                       this.closeChannel(addr, channel);
                       log.warn("invokeSync: close socket because of timeout, {}ms, {}", timeoutMillis, addr);
                   }
                   log.warn("invokeSync: wait response timeout exception, the channel[{}]", addr);
                   throw e;
               }
           } else {
               this.closeChannel(addr, channel);
               throw new RemotingConnectException(addr);
           }
       }
   ```
   
   按修改后的内容运行不会出现异常。调试中发现异常的原因为执行到以下代码抛了异常
   ```
    doBeforeRpcHooks(channelRemoteAddr, request);
     long costTime = System.currentTimeMillis() - beginStartTime;
                   if (timeoutMillis < costTime) {
                       throw new RemotingTimeoutException("invokeSync call the addr[" + addr + "] timeout");
                   }
   ```
   
   是否因为本机有虚拟多网卡等情况时用Channel channel 执行 doBeforeRpcHooks(channel, request);花费的时间比用doBeforeRpcHooks(channelRemoteAddr, request);花费时间长,导致timeoutMillis < costTime为true ,抛出了异常?


-- 
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: commits-unsubscribe@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] win10 mqadmin statsAll -n 10.0.24.108:9876 StatsAllSubCommand command failed [rocketmq]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #6546: win10 mqadmin statsAll -n 10.0.24.108:9876  StatsAllSubCommand command failed
URL: https://github.com/apache/rocketmq/issues/6546


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] win10 mqadmin statsAll -n 10.0.24.108:9876 StatsAllSubCommand command failed [rocketmq]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #6546:
URL: https://github.com/apache/rocketmq/issues/6546#issuecomment-2046225733

   This issue is stale because it has been open for 365 days with no activity. It will be closed in 3 days if no further activity occurs.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] win10 mqadmin statsAll -n 10.0.24.108:9876 StatsAllSubCommand command failed [rocketmq]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #6546:
URL: https://github.com/apache/rocketmq/issues/6546#issuecomment-2053811873

   This issue was closed because it has been inactive for 3 days since being marked as stale.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org