GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [fix][broker] Return errors for discarded ACKs with receipts by AuroraTwinkle · Pull Request #27128 · apache/pulsar

Conversation

@AuroraTwinkle

@AuroraTwinkle AuroraTwinkle commented Oct 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Fixes #23261

Motivation

With ACK receipts enabled, an acknowledgment discarded during topic transfer or after a consumer becomes unavailable receives no response. The client waits for its request timeout even though the broker already knows that it will not process the ACK.

Modifications

  • Return an ACK response with ServiceNotReady when the topic is transferring, and ConsumerNotFound when the consumer is missing or its subscription future is pending, failed or cancelled.
  • Send these errors only when the ACK carries a request ID. Preserve ACK handling without receipts, the ignored-ACK counter during transfer, and the normal asynchronous completion path.
  • Add protocol regressions and an end-to-end topic-unload regression using a real broker, bookie and Java client.

The end-to-end test delays an in-flight ACK, unloads its topic through the admin API, and then forwards the original ACK frame. It checks that the client ACK future fails with the correlated ConsumerNotFound response. The close-consumer notification remains delayed until a second producer successfully publishes on the same connection, ensuring that a disconnect cannot account for the failed ACK. The test covers individual and cumulative ACKs, with successful no-unload controls.

Verifying this change

  • Make sure that the change passes the CI checks.

Against the original ServerCnx implementation, the two end-to-end unload cases fail while waiting for the missing ACK response; both no-unload controls pass.

With the fix, 40 tests passed, with zero failures, errors or skipped tests and retries disabled:

  • AckReceiptOnTopicUnloadTest: four end-to-end cases.
  • ServerCnxTest.testAck*: 15 protocol cases covering unavailable consumers, topic transfer, receipt mode on/off, request/consumer ID correlation, and normal asynchronous ACK success/failure.
  • ConsumerTest: 19 existing ACK state/completion cases.
  • PulsarCommandSenderImplTest: two existing serialization cases.

Repository-wide sanityCheck, including quickCheck, passed. Full CI for this revision is not yet verified.

./gradlew :pulsar-broker:test \
  --tests 'org.apache.pulsar.broker.service.AckReceiptOnTopicUnloadTest' \
  --tests 'org.apache.pulsar.broker.service.ServerCnxTest.testAck*' \
  --tests 'org.apache.pulsar.broker.service.ConsumerTest' \
  --tests 'org.apache.pulsar.broker.service.PulsarCommandSenderImplTest' \
  -PtestRetryCount=0 -PtestFailFast=false -PtestMaxParallelForks=1 sanityCheck

Does this pull request potentially affect one of the following parts:

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Discarded ACKs that request receipts now receive an existing ACK_RESPONSE error instead of waiting for a timeout. No command, field or error code is added.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AuroraTwinkle
[fix][broker] Return errors for discarded ACKs with receipts
6f04090
Respond to ACKs carrying a request ID when their consumer is unavailable
or their topic is transferring, instead of leaving the client waiting
for a timeout. Preserve ACK handling without receipts and transfer
statistics. Add protocol regressions and asynchronous completion controls.

Fixes apache#23261

Assisted-by: OpenAI Codex
@poorbarcode poorbarcode assigned AuroraTwinkle Oct 27, 2026
@poorbarcode poorbarcode added release/4.2.6 release/4.0.15 release/5.0.2 labels Oct 27, 2026
@poorbarcode poorbarcode added this to the 5.1.0 milestone Oct 27, 2026
poorbarcode
poorbarcode reviewed Oct 27, 2026
View reviewed changes
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AuroraTwinkle
[improve][test] Cover ACK receipts after topic unload end to end
5a5cab0
Delay an in-flight ACK until the admin API unloads its topic, then check
that the Java client's ACK future receives the correlated error response.
Cover individual and cumulative ACKs, with no-unload success controls.
Verify a second producer can still publish on the same connection while
the close notification is delayed.
@AuroraTwinkle AuroraTwinkle mentioned this pull request Oct 27, 2026
[fix][broker] Return errors for discarded ACKs with receipts AuroraTwinkle/pulsar#15
Open
1 of 11 tasks
Denovo1998
Denovo1998 approved these changes Oct 27, 2026
View reviewed changes

@Denovo1998 Denovo1998 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Denovo1998
Denovo1998 requested a review from poorbarcode October 27, 2026 12:21
poorbarcode
poorbarcode approved these changes Oct 27, 2026
View reviewed changes
@poorbarcode
poorbarcode merged commit dcec727 into apache:master Oct 27, 2026
44 checks passed

Uh oh!

There was an error while loading. Please reload this page.

lhotari pushed a commit that referenced this pull request Oct 28, 2026
@AuroraTwinkle @lhotari
[fix][broker] Return errors for discarded ACKs with receipts (#27128)
ccce909
(cherry picked from commit dcec727)
@lhotari lhotari added the cherry-picked/branch-5.0 label Oct 28, 2026
danrubAtPlanview added a commit to danrubAtPlanview/pulsar-dotpulsar that referenced this pull request Nov 1, 2026
@danrubAtPlanview @claude
Make the broker image of the tests configurable
b545b61
Three fixtures hard-coded apachepulsar/pulsar:4.0.9, and the three
tests that need a broker fix that no published image has were skipped
with a static Skip. They could only run after someone edited the code.

BrokerImage reads two variables:
- DOTPULSAR_TESTS_PULSAR_IMAGE replaces the default image
- DOTPULSAR_TESTS_BROKER_FIXES lists the apache/pulsar pull requests
  that the image has, for example 27128,27082

The two unload rows of ConsumerTests (apache/pulsar#27128) and the
row of TopicTransactionBufferPublishOrderTests (#27082) are skipped
unless their number is in the list, with a message that says how to
run them. Without the variables nothing changes: the same 14
integration tests are skipped. With DOTPULSAR_TESTS_BROKER_FIXES set
on the default image the two ConsumerTests rows run and fail with the
ack receipt timeout, which is the bug in that image.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Nov 21, 2026
[improve][ci] Run CI for the 4.2.6 backports to branch-4.2 (do not merge) #27680
Closed
[improve][ci] Run CI for the 4.2.6 backports to branch-4.2 (do not merge) #27681
Closed
[improve][ci] Run CI for the 4.2.6 backports to branch-4.2 (do not merge) #27684
Closed
@lhotari lhotari added cherry-picked/branch-4.2 cherry-picked/branch-4.0 labels Nov 21, 2026
poorbarcode pushed a commit to poorbarcode/pulsar that referenced this pull request Nov 26, 2026
@AuroraTwinkle @lhotari
[fix][broker] Return errors for discarded ACKs with receipts (apache#…
a3ac8a7
…27128)

(cherry picked from commit dcec727)
poorbarcode pushed a commit to poorbarcode/pulsar that referenced this pull request Nov 26, 2026
@AuroraTwinkle @lhotari
[fix][broker] Return errors for discarded ACKs with receipts (apache#…
44db4db
…27128)

(cherry picked from commit dcec727)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@poorbarcode poorbarcode poorbarcode approved these changes
@Denovo1998 Denovo1998 Denovo1998 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@AuroraTwinkle AuroraTwinkle

Labels

cherry-picked/branch-4.0 cherry-picked/branch-4.2 cherry-picked/branch-5.0 release/4.0.15 release/4.2.6 release/5.0.2

Projects

None yet

Milestone

5.1.0

Development

Successfully merging this pull request may close these issues.

[Bug] When ack receipts are enabled, no response is sent to the client if the topic has been unloaded or is being transferred

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@AuroraTwinkle @poorbarcode @Denovo1998 @lhotari
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.