You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/02/26 02:09:02 UTC

[GitHub] [rocketmq] linkypi opened a new issue #2697: 消息已成功消费,但控制台中消息的状态却显示 NOT_CONSUME_YET

linkypi opened a new issue #2697:
URL: https://github.com/apache/rocketmq/issues/2697


     rocketmq 4.8.0 单点部署在docker容器中,其中broker的配置文件中已配置brokerIP1 ,配置的是域名,而非实际IP地址:
   ``` 
   brokerIP1=rmqbroker
   ```
   如此配置就会导致问题的出现,若配置的是实际的IP则MQ消息状态正常。通过调试源码发现 rocketmq-tools 在判断消息是否已消费时未对域名进行解析导致。
   ![image](https://user-images.githubusercontent.com/4386639/109244141-211d0e80-7819-11eb-9ccb-79de5323f676.png)
   
   修复后:
   ![image](https://user-images.githubusercontent.com/4386639/109244722-26c72400-781a-11eb-8b56-0244a0c1768f.png)
   源码:
   ``` java
     while (it.hasNext()) {
          Entry<MessageQueue, OffsetWrapper> next = it.next();
          MessageQueue mq = next.getKey();
          if (mq.getTopic().equals(msg.getTopic()) && mq.getQueueId() == msg.getQueueId()) {
              BrokerData brokerData = ci.getBrokerAddrTable().get(mq.getBrokerName());
              if (brokerData != null) {
                  final String msgStoreHost = RemotingUtil.socketAddress2String(msg.getStoreHost());
                  final String brokerHost = getBrokerIpFromCluster(brokerData);
                  log.info("============= msgHostIp: {}, msg.getStoreHost(): {} =============", msgStoreHost, brokerHost);
   
                  if (msgStoreHost.equals(brokerHost)) {
                      log.info("next.getValue().getConsumerOffset(): {}, msg.getQueueOffset(): {}",
                              next.getValue().getConsumerOffset(), msg.getQueueOffset());
                      if (next.getValue().getConsumerOffset() > msg.getQueueOffset()) {
                          return true;
                      }
                  }
              }
          }
      }
   
     private String getBrokerIpFromCluster(BrokerData brokerData ) throws UnknownHostException {
           String addr = brokerData.getBrokerAddrs().get(MixAll.MASTER_ID);
           final String[] arr = addr.split(":");
           final String host = arr[0];
           final String brokerIp = InetAddress.getAllByName(host)[0].getHostAddress() + ":" + arr[1];
           return brokerIp;
       }
   ```
   希望尽早修复改问题。


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] vongosling commented on issue #2697: 消息已成功消费,但控制台中消息的状态却显示 NOT_CONSUME_YET

Posted by GitBox <gi...@apache.org>.
vongosling commented on issue #2697:
URL: https://github.com/apache/rocketmq/issues/2697#issuecomment-786992448


   Thanks for your opt. you could make a pr as fengyihui suggested. BTW, we must keep in mind that InetAddress.getByName() implementation is blocking and standard Java libraries lack any non-blocking implementations.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] ahaha-vip commented on issue #2697: Console showed NOT_CONSUME_YET, but no consume actually?

Posted by GitBox <gi...@apache.org>.
ahaha-vip commented on issue #2697:
URL: https://github.com/apache/rocketmq/issues/2697#issuecomment-958606475


   遇到同样的问题,请问这是只是console显示有误,还是也会影响消息的正常消费?


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

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



[GitHub] [rocketmq] ahaha-vip commented on issue #2697: Console showed NOT_CONSUME_YET, but no consume actually?

Posted by GitBox <gi...@apache.org>.
ahaha-vip commented on issue #2697:
URL: https://github.com/apache/rocketmq/issues/2697#issuecomment-958606475


   遇到同样的问题,请问这是只是console显示有误,还是也会影响消息的正常消费?


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

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



[GitHub] [rocketmq] ahaha-vip commented on issue #2697: Console showed NOT_CONSUME_YET, but no consume actually?

Posted by GitBox <gi...@apache.org>.
ahaha-vip commented on issue #2697:
URL: https://github.com/apache/rocketmq/issues/2697#issuecomment-958606475


   遇到同样的问题,请问这是只是console显示有误,还是也会影响消息的正常消费?


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

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



[GitHub] [rocketmq] linkypi commented on issue #2697: Console showed NOT_CONSUME_YET, but no consume actually?

Posted by GitBox <gi...@apache.org>.
linkypi commented on issue #2697:
URL: https://github.com/apache/rocketmq/issues/2697#issuecomment-1049387134


   > 遇到同样的问题,请问这是只是 console 显示有误,还是也会影响消息的正常消费?
   
   Message consumption is normal, but the console display is incorrect.


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

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



[GitHub] [rocketmq] xhrg commented on issue #2697: Console showed NOT_CONSUME_YET, but no consume actually?

Posted by GitBox <gi...@apache.org>.
xhrg commented on issue #2697:
URL: https://github.com/apache/rocketmq/issues/2697#issuecomment-800248534


   If rocketmq use docker or multiple network cards, rocketmq should initiate a UDP request to an external IP, and then get the IP address of the current server. rocketmq cannot use the system call of InetAddress API。It's just my idea
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] ahaha-vip commented on issue #2697: Console showed NOT_CONSUME_YET, but no consume actually?

Posted by GitBox <gi...@apache.org>.
ahaha-vip commented on issue #2697:
URL: https://github.com/apache/rocketmq/issues/2697#issuecomment-958606475


   遇到同样的问题,请问这是只是console显示有误,还是也会影响消息的正常消费?


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

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



[GitHub] [rocketmq] fengyiluo commented on issue #2697: 消息已成功消费,但控制台中消息的状态却显示 NOT_CONSUME_YET

Posted by GitBox <gi...@apache.org>.
fengyiluo commented on issue #2697:
URL: https://github.com/apache/rocketmq/issues/2697#issuecomment-786476922


   Mention a pull request by yourself and associate this issue.


----------------------------------------------------------------
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:
users@infra.apache.org