jiazhai commented on issue #3287: 
ConsumerImpl.redeliverUnacknowledgedMessages() get empty messageids
URL: https://github.com/apache/pulsar/issues/3287#issuecomment-451123291
 
 
   @sijie #3118 is another change, and it is not intention to do the fix for 
this issue. If we want to do the fix in 2.2 or earlier, we may need another PR.
   
   And in the 2.2.1 code:
   ```
       public void start(PulsarClientImpl client, ConsumerBase<?> consumerBase, 
long ackTimeoutMillis) {
           this.stop();
           timeout = client.timer().newTimeout(new TimerTask() {
               @Override
               public void run(Timeout t) throws Exception {
                   if (isAckTimeout()) {          < === 1
                       log.warn("[{}] {} messages have timed-out", 
consumerBase, oldOpenSet.size());  < === 2
                       Set<MessageId> messageIds = new HashSet<>();
                       oldOpenSet.forEach(messageIds::add);
                       oldOpenSet.clear();
                       
consumerBase.redeliverUnacknowledgedMessages(messageIds);   < ===
                   }
                   toggle();
                   timeout = client.timer().newTimeout(this, ackTimeoutMillis, 
TimeUnit.MILLISECONDS);
               }
           }, ackTimeoutMillis, TimeUnit.MILLISECONDS);
       }
   ``` 
   In 
[isAckTimeout](https://github.com/apache/pulsar/blob/v2.2.1-candidate-2/pulsar-client/src/main/java/org/apache/pulsar/client/impl/UnAckedMessageTracker.java#L162),
 it has already checked `oldOpenSet.isEmpty()`,  so the race window between "< 
===1" and "< ===2" should be really small. it should be hard to trigger.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to