Skip to content

[Bug] When using the delayed message delivery of Apache pulsar version 2.10, the message is not received at the expected delay time #18399

Closed as not planned

Description

@como-ca

Search before asking

  • I searched in the issues and found nothing similar.

Version

2.10.0

Minimal reproduce step

We produce messages in the following way: MessageId messageId=producer. newMessage() deliverAfter(time, timeUnit).value(msg.getBytes(StandardCharsets.UTF_8)).send();
In the early stage of production (when the amount of data is small), what can be prepared will be executed at the expected time of delay, but when the amount of data is large, there will be different degrees of delay, even more than one day, one hour, etc .

In addition, the subscription type we use is: subscriptionType=SubscriptionType Shared mode, we can provide our consumer initialization code

<T> Consumer<T> createConsumer(String topic, Schema<T> schema, String subscriptionName,
                                MessageListener<T> listener,
                                int ackTimeout) throws PulsarClientException {
     return client.newConsumer(schema)
             .topic(topic)
             .subscriptionName(subscriptionName)
             .ackTimeout(ackTimeout, TimeUnit.MINUTES)
             .subscriptionType(SubscriptionType.Shared)
             .enableRetry(true)
             .messageListener(listener)
             .negativeAckRedeliveryDelay(5, TimeUnit.SECONDS)
             .deadLetterPolicy(DeadLetterPolicy.builder()
                     .maxRedeliverCount(maxRedeliveryCount)
                     .retryLetterTopic(DELAY_DELIVER_RETRY)
                     .deadLetterTopic("persistent://public/default/delay_deliver_dead")
                     .build())
             .consumerName(appName)
             .subscribe();
 }

What did you expect to see?

In the deliverAfter mode, time is specified as 10, and the unit is minute. After the message is produced, it should be executed within the specified delay time of each message

What did you see instead?

Through the analysis of logs and our own business library, we found that a large number of messages were overstocked and the execution was delayed. For example, we used the deliverAfter mode. The time was specified as 10, and the unit was minutes. However, the execution may be delayed for 1 hour, 2 hours, or even one day.

Anything else?

Cluster configuration, 3POD is 16c16g per pod, and the daily traffic is about 40w/day

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. added
    type/bug
    on Nov 10, 2022
  2. liangyuanpeng commented on Nov 10, 2022

    @liangyuanpeng
    Contributor

    Could you try it on 2.10.2?

  3. jesse996 commented on Dec 10, 2022

    @jesse996

    the delay message not working

    producer.newMessage()
                        .deliverAfter(6L, TimeUnit.MINUTES)
                        .value("msg".getBytes())
                        .send();
    

    i expect to receive it after 6 minutes,but actually i receive it immediately. pulsar vertion:2.10.2

  4. github-actions commented on Jan 10, 2023

    @github-actions

    The issue had no activity for 30 days, mark with Stale label.

  5. henghengdh commented on Apr 3, 2023

    @henghengdh

    Search before asking

    • I searched in the issues and found nothing similar.

    Version

    2.10.0

    Minimal reproduce step

    We produce messages in the following way: MessageId messageId=producer. newMessage() deliverAfter(time, timeUnit).value(msg.getBytes(StandardCharsets.UTF_8)).send(); In the early stage of production (when the amount of data is small), what can be prepared will be executed at the expected time of delay, but when the amount of data is large, there will be different degrees of delay, even more than one day, one hour, etc .

    In addition, the subscription type we use is: subscriptionType=SubscriptionType Shared mode, we can provide our consumer initialization code

    <T> Consumer<T> createConsumer(String topic, Schema<T> schema, String subscriptionName,
                                    MessageListener<T> listener,
                                    int ackTimeout) throws PulsarClientException {
         return client.newConsumer(schema)
                 .topic(topic)
                 .subscriptionName(subscriptionName)
                 .ackTimeout(ackTimeout, TimeUnit.MINUTES)
                 .subscriptionType(SubscriptionType.Shared)
                 .enableRetry(true)
                 .messageListener(listener)
                 .negativeAckRedeliveryDelay(5, TimeUnit.SECONDS)
                 .deadLetterPolicy(DeadLetterPolicy.builder()
                         .maxRedeliverCount(maxRedeliveryCount)
                         .retryLetterTopic(DELAY_DELIVER_RETRY)
                         .deadLetterTopic("persistent://public/default/delay_deliver_dead")
                         .build())
                 .consumerName(appName)
                 .subscribe();
     }
    

    What did you expect to see?

    In the deliverAfter mode, time is specified as 10, and the unit is minute. After the message is produced, it should be executed within the specified delay time of each message

    What did you see instead?

    Through the analysis of logs and our own business library, we found that a large number of messages were overstocked and the execution was delayed. For example, we used the deliverAfter mode. The time was specified as 10, and the unit was minutes. However, the execution may be delayed for 1 hour, 2 hours, or even one day.

    Anything else?

    Cluster configuration, 3POD is 16c16g per pod, and the daily traffic is about 40w/day

    Are you willing to submit a PR?

    • I'm willing to submit a PR!

    Have you solved the problem?

  6. github-actions commented on May 5, 2023

    @github-actions

    The issue had no activity for 30 days, mark with Stale label.

  7. sacred-virus commented on Mar 15, 2024

    @sacred-virus

    Is it solved in new version? @como-ca

  8. merlimat commented on Oct 24, 2026

    @merlimat
    Contributor

    Thanks @como-ca for the report. This was reported on Pulsar 2.10, which is no longer supported; the supported releases are 4.0.x, 4.2.x and 5.0.x. Much of the code involved has changed since, and the problem hasn't been confirmed on a current release, so I'm closing it as part of cleaning up old reports. If you still see it on a supported release, please open a new issue with the version and steps to reproduce, and link this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Staletype/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions