rocketmq icon indicating copy to clipboard operation
rocketmq copied to clipboard

[Bug] Msg will be consumed even if it has reached max reconsumeTimes in some case

Open cserwen opened this issue 1 year ago • 0 comments

Before Creating the Bug Report

  • [X] I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • [X] I have searched the GitHub Issues and GitHub 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: linux

RocketMQ version

branch: develop

JDK Version

No response

Describe the Bug

PushConsumer use pop mode to consume, configurations is :

popInvisibleTime=10000   # 10s
clientRebalance=false # use pop mode
maxReconsumeTimes=0  # no retry

If consumption cost time is large than popInvisibleTime, it will still be consumed again and maxRecosumeTimes is not worked

Steps to Reproduce

DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(CONSUMER_GROUP);
consumer.subscribe(TOPIC, "*");
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
consumer.registerMessageListener(new MessageListenerConcurrently() {
    @Override
    public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
        System.out.printf("%s Receive New Messages: %s %n", Thread.currentThread().getName(), msgs);
        try {
            Thread.sleep(15000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
    }
});
consumer.setClientRebalance(false);
consumer.setPopInvisibleTime(10000);
consumer.setMaxReconsumeTimes(0);
consumer.start();
System.out.printf("Consumer Started.%n");

What Did You Expect to See?

Messages are consumed only once

What Did You See Instead?

Always being consumed

Additional Context

No response

cserwen avatar Jun 26 '24 08:06 cserwen