You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "dev-techmoe (via GitHub)" <gi...@apache.org> on 2023/09/06 03:34:58 UTC

[GitHub] [rocketmq] dev-techmoe opened a new issue, #7304: [Bug] [Client] DefaultLitePullConsumerImpl.poll not working correct

dev-techmoe opened a new issue, #7304:
URL: https://github.com/apache/rocketmq/issues/7304

   ### 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
   
   Win10 22H2
   
   ### RocketMQ version
   
   - Server version: 5.1.3
   - the version of `rocketmq-spring-boot-starter`: 2.2.3
   - `rocketmq-client`: 5.0.0
   
   ### JDK Version
   
   openjdk 1.8.0_352 (Zulu 8.66.0.15-CA-win64)
   
   ### Describe the Bug
   
   The `poll` method can't return a batch of data after a while, only one item.
   
   ### Steps to Reproduce
   
   producer
   
   ```java
   Thread t = new Thread(() -> {
       int i = 1;
       while (true) {
           Message<Integer> message = MessageBuilder.withPayload(i).build();
   
           log.info("send: {}", i);
           rocketMQTemplate.syncSend("test-topic3", i);
           i++;
           try {
               Thread.sleep(10);
           } catch (InterruptedException e) {
               throw new RuntimeException(e);
           }
       }
   });
   t.start();
   ```
   
   consumer
   
   ```java
   Thread t = new Thread(() -> {
       DefaultLitePullConsumer litePullConsumer;
       litePullConsumer = new DefaultLitePullConsumer("test-consumer-group-poll-2");
       litePullConsumer.setNamesrvAddr(nameServers);
       try {
           litePullConsumer.subscribe("test-topic3", "");
       } catch (MQClientException e) {
           throw new RuntimeException(e);
       }
       litePullConsumer.setPullBatchSize(32);
       try {
           litePullConsumer.start();
       } catch (MQClientException e) {
           throw new RuntimeException(e);
       }
       while (true) {
           List<MessageExt> messageExtList = litePullConsumer.poll(10000);
           log.info("messageCount: {}", messageExtList.size());
       }
   });
   t.start();
   ```
   
   
   
   ### What Did You Expect to See?
   
   Each `poll` call should return 32 messages in 10s.
   
   ### What Did You See Instead?
   
   Only one message was received after a while.
   
   
   ```
   2023-09-06 11:19:16.649  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.651  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.651  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.652  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.652  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.653  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.653  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.653  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.655  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.655  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.655  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.656  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.657  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.658  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.658  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.658  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.660  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.660  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.660  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.660  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 32
   2023-09-06 11:19:16.662  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 15
   2023-09-06 11:19:16.662  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 17
   2023-09-06 11:19:16.662  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 16
   2023-09-06 11:19:16.662  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 17
   2023-09-06 11:19:16.665  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 1
   2023-09-06 11:19:16.679  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 1
   2023-09-06 11:19:16.691  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 1
   2023-09-06 11:19:16.704  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 1
   2023-09-06 11:19:16.716  INFO 74704 --- [       Thread-5] c.e.demo.rkmq.RocketMqBatchListener      : messageCount: 1
   ...
   ```
   
   ### Additional Context
   
   After reading the source code of the java client I found this implementation
   
   https://github.com/apache/rocketmq/blob/31d10385d1616445478104ce9ef463a8c4852ba2/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java#L611
   
   Can someone explain to me what the meaning of this is? Why I need call `consumeRequestCache.poll` after processQueue has been dropped? And this expression still got false in my code. I can't figure it out.


-- 
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] [Bug] [Client] DefaultLitePullConsumerImpl.poll not working correctly [rocketmq]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #7304: [Bug] [Client] DefaultLitePullConsumerImpl.poll not working correctly
URL: https://github.com/apache/rocketmq/issues/7304


-- 
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] [Bug] [Client] DefaultLitePullConsumerImpl.poll not working correctly [rocketmq]

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

   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


[GitHub] [rocketmq] dev-techmoe commented on issue #7304: [Bug] [Client] DefaultLitePullConsumerImpl.poll not working correctly

Posted by "dev-techmoe (via GitHub)" <gi...@apache.org>.
dev-techmoe commented on issue #7304:
URL: https://github.com/apache/rocketmq/issues/7304#issuecomment-1707809057

   It seems that I understood what line 611 means, but I have not solved my problem yet.


-- 
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] [Bug] [Client] DefaultLitePullConsumerImpl.poll not working correctly [rocketmq]

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

   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