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 — [Bug][client] V5 transaction coordinator discovery: listener-aware leader URLs and watch connection handling · Issue #27739 · apache/pulsar

[Bug][client] V5 transaction coordinator discovery: listener-aware leader URLs and watch connection handling #27739

New issue
Copy link
New issue
Copy link
Todo
Todo
[Bug][client] V5 transaction coordinator discovery: listener-aware leader URLs and watch connection handling#27739
Copy link
Assignees
codelipenghui
Labels
type/bugThe PR fixed a bug or issue reported a bug

Description

@codelipenghui
codelipenghui
opened on Nov 24, 2026
Issue body actions

Search before reporting

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

User environment

Pulsar master (5.1.0-SNAPSHOT): a Java client using the v5 SDK (metadata-store transaction coordinator discovery) against brokers with transactionCoordinatorScalableTopicsEnabled.

Issue Description

These are follow-ups from the review of #27387, which made the direct route of WatchTcAssignmentsDiscovery reachable.

  1. Listener-aware leader URLs. TcLeader is built from pulsar.getBrokerServiceUrl()/getBrokerServiceUrlTls(), which is the internal listener, and ServerCnx forwards it unchanged in the assignment snapshot. CommandWatchTcAssignments has no listener field, so the broker can't map it. [fix][client] Distinguish direct TC discovery from proxy pairing #27387 routes a listener-named client's handlers through the service URL. Since [fix][broker] Accept v5 transaction coordinator handshakes only on the elected leader #27580 that only works when the service URL reaches the leader, so a multi-broker cluster used with listenerName can't run v5 transactions. Proposed fix: add an optional advertised_listener_name to CommandWatchTcAssignments, fall back to ServerCnx.listenerName the way lookup does, and resolve each leader's URL for that listener.
  2. TransactionMetaStoreHandler.retargetLeader closes the handler's current channel. In direct mode that channel is the pooled (leader, leader, key) connection that producers and consumers on the broker also use; behind a proxy it's (leader, proxy, key), which is also shared. A leader move therefore disconnects every producer and consumer on that connection. The handler should drop only its own registration, which needs a deregistration method on ClientCnx, or use a dedicated connection key. The NotAllowedException branch of connectionOpened and the registerToConnection failure path close the channel the same way.
  3. The watch's probe and any-broker pairing are pooled. ConnectionPool.releaseConnection only closes when pooling is disabled, and with connectionsPerBroker=1 the key is always 0. So after an unsupported probe or pairing, every retry gets the same connection and the same broker back. Each reuse also clears the idle time, because the 30s maximum backoff is shorter than the 60s idle threshold. A dedicated connection key for the watch would fix this.
  4. ClientCnx.idleCheck() doesn't count tcAssignmentsWatchers. A connection used only by the watch is closed as idle every couple of minutes, and the watch reopens. This matters for item 3, because a dedicated watch connection would be used by the watch alone.

Error messages

None. Found in code review.

Reproducing the issue

  1. Configure a broker with advertisedListeners=internal:pulsar://<internal-host>:6650,external:pulsar://<public-host>:6650 and connect a v5 client from outside with listenerName=external. The snapshot hands it pulsar://<internal-host>:6650. With [fix][client] Distinguish direct TC discovery from proxy pairing #27387 the handlers route through the service URL, which reaches the leader only when the service URL lands on it.
  2. With a direct client, let a snapshot move a coordinator to another broker while producers or consumers are connected to the old leader. They are disconnected together with the coordinator handler.
  3. With a direct client behind a load balancer, during a rolling enable of transactionCoordinatorScalableTopicsEnabled, the watch probe keeps landing on the same broker after each failure.

Additional information

Review discussion: #27387

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. codelipenghui
    added
    type/bugThe PR fixed a bug or issue reported a bug
    on Nov 24, 2026
  2. codelipenghui
    self-assigned this
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @codelipenghui
    codelipenghui

Labels

type/bugThe PR fixed a bug or issue reported a bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    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.