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 retryable error for timed-out end transactions by poorbarcode · Pull Request #26917 · apache/pulsar

Conversation

@poorbarcode

@poorbarcode poorbarcode commented Oct 14, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Motivation

When a topic transaction buffer times out while handling EndTxnOnPartition, the broker returns UnknownError. The transaction coordinator treats that response as non-retryable, which can leave a transaction in COMMITTING or ABORTING until the coordinator is reloaded.

Steps of issue occurring

  • Client: commit transaction
  • Broker-1(the owner of the transaction coordinator): received the request to commit transactions
    • Update the status of the transaction to Committing
    • Sync status to Transaction Buffers
  • Broker-2(the owner of the transaction buffer)
    • throws TimeoutException
    • responds with an UnknownError to Broker-1
  • Broker-1: received UnknownError
    • Stops to retry; the status of the transaction remains Committing

The issue can be solved by unloading the transaction coordinators: pulsar-admin topics unload persistent://pulsar/system/transaction_coordinator_assign-partition-x, because the pending txn will be retried when the Transaction Metadata Store is rebuilt.

Modifications

  • Translate an otherwise-unmapped TimeoutException from EndTxnOnPartition to ServerError.ServiceNotReady.
  • ServiceNotReady is decoded by the transaction-buffer client as a retryable ServiceNotReadyException, allowing the coordinator's existing retry logic to retry the end-transaction request.
  • Add a transaction-buffer client test that triggers an asynchronous endTxn timeout through a real broker/client request path and verifies the client receives ServiceNotReadyException.

Follow-up: monitoring and alerting

This PR focuses on the protocol-error classification. A follow-up should add a coordinator-level pulsar_txn_oldest_state_age_seconds gauge, labeled by cluster, broker, coordinator ID, and non-terminal state (initially COMMITTING and ABORTING). It should not include transaction ID or topic labels, to avoid unbounded cardinality.

A warning alert can trigger when pulsar_txn_oldest_state_age_seconds{state=~"COMMITTING|ABORTING"} > 600 persists, to identify coordinators that are no longer making end-transaction progress.

Tests

./gradlew :pulsar-broker:test --tests org.apache.pulsar.broker.transaction.buffer.TransactionBufferClientTest.testCommitOnTopicTimeoutReturnsServiceNotReady -PtestRetryCount=0
./gradlew :pulsar-broker:checkstyleTest

Sorry, something went wrong.

Uh oh!

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

All reactions
@poorbarcode
[fix][broker] Retry end transaction after timeout
eb4230b
@poorbarcode poorbarcode added release/4.2.6 release/4.0.15 labels Oct 14, 2026
@poorbarcode poorbarcode self-assigned this Oct 14, 2026
@poorbarcode poorbarcode added the type/bug The PR fixed a bug or issue reported a bug label Oct 14, 2026
@poorbarcode poorbarcode added this to the 5.1.0 milestone Oct 14, 2026
codelipenghui
codelipenghui approved these changes Oct 14, 2026
View reviewed changes

@codelipenghui codelipenghui 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.

Reviewed at eb4230be108c0ea4367040871655ea87172687ce.

No actionable findings identified within the reviewed scope. The narrow timeout mapping preserves existing error classifications and correctly reuses the coordinator's retry behavior.

Validation: the new regression passes with the fix and fails with the parent implementation for the expected error-classification reason. All 14 tests in the affected test class pass, as do broker main/test Checkstyle and diff whitespace checks.

Sorry, something went wrong.

Uh oh!

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

All reactions
@merlimat
merlimat merged commit e6a0f83 into apache:master Oct 14, 2026
44 of 46 checks passed

Uh oh!

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

@lhotari lhotari added release/4.0.14 release/4.0.15 and removed release/4.0.15 release/4.0.14 labels Oct 14, 2026
poorbarcode added a commit that referenced this pull request Oct 15, 2026
@poorbarcode
[fix][broker] Return retryable error for timed-out end transactions (#…
84f8ca9
…26917)

(cherry picked from commit e6a0f83)
@poorbarcode poorbarcode added the cherry-picked/branch-4.2 label Oct 15, 2026
poorbarcode added a commit that referenced this pull request Oct 15, 2026
@poorbarcode
[fix][broker] Return retryable error for timed-out end transactions (#…
459f530
…26917)

(cherry picked from commit e6a0f83)
@poorbarcode poorbarcode added the cherry-picked/branch-4.0 label Oct 15, 2026
lhotari pushed a commit that referenced this pull request Oct 15, 2026
@poorbarcode @lhotari
[fix][broker] Return retryable error for timed-out end transactions (#…
8cec016
…26917)

(cherry picked from commit e6a0f83)
@lhotari lhotari added release/5.0.1 cherry-picked/branch-5.0 labels Oct 15, 2026
lhotari added a commit that referenced this pull request Oct 17, 2026
@lhotari
[fix][broker] Don't hang end txn requests when the error response has…
1857ec2
… no message

The broker leaves the message of an end txn on partition/subscription error
response unset when the failure has no message, such as the TimeoutException
that #26917 maps to ServiceNotReady. With LightProto 0.4 on branch-4.0,
reading an unset field throws IllegalStateException, so the response handler
failed before completing the request's future and the transaction buffer
client request hung until it timed out.
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Nov 16, 2026
@poorbarcode @nodece
[fix][broker] Return retryable error for timed-out end transactions (a…
2a5e085
…pache#26917)

(cherry picked from commit e6a0f83)
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Nov 16, 2026
@lhotari @nodece
[fix][broker] Don't hang end txn requests when the error response has…
1ad8a18
… no message

The broker leaves the message of an end txn on partition/subscription error
response unset when the failure has no message, such as the TimeoutException
that apache#26917 maps to ServiceNotReady. With LightProto 0.4 on branch-4.0,
reading an unset field throws IllegalStateException, so the response handler
failed before completing the request's future and the transaction buffer
client request hung until it timed out.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@codelipenghui codelipenghui codelipenghui approved these changes

Uh oh!

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

Assignees

@poorbarcode poorbarcode

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.1 type/bug The PR fixed a bug or issue reported a bug

Projects

None yet

Milestone

5.1.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

4 participants

@poorbarcode @codelipenghui @merlimat @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.