apache / apache/pulsar

[Bug] TTL Cleaned up delay-delivered messages

Open
#21,898 4 comments 1 reaction 0 assignees View on GitHub
type/bug
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.

### Version

pulsar running on docker: `apachepulsar/pulsar:3.1.1`

### Minimal reproduce step

set the `broker.conf`: `ttlDurationDefaultInSeconds=7200`
code for sending message:
```java
var messageBuilder = producer.newMessage().value(payload).deliverAfter(21_600_000L, TimeUnit.MILLISECONDS);
messageBuilder.sendAsync();
```

### What did you expect to see?

The consumer received the message after 21,600,000ms(6 hours).

### What did you see instead?

The message was cleared by TTL and the consumer did not receive anything.

### Anything else?

On the one hand, I want to confirm whether this is the design, because this is quite counter-intuitive. We generally think that the expiration time is calculated from the delivery time of the message.

If this is expected, then how can I coordinate my TTL configuration along with the sending options.

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Start by examining the TTL and delayed-delivery behavior described for Apache Pulsar 3.1.1, using the provided broker configuration and Java reproduction. Determine whether expiration is calculated from send time or delivery time, then document or fix the behavior and verify it with a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.