Skip to content

[Bug] C++ client cannot switch IPs when serviceUrl is a domain name with multiple resolved IPs #502

@zhangjialong666

Description

@zhangjialong666

Search before asking

  • I searched in the issues and found nothing similar.

Version

latest

Minimal reproduce step

  1. Configure a DNS entry (e.g., pulsar.example.com) that resolves to multiple IP addresses.
  2. Set the Pulsar C++ client serviceUrl to use this domain (e.g., pulsar://pulsar.example.com:6650).
  3. Start the client and establish a connection.
  4. Make one of the backend IPs unreachable (e.g., shut down the broker node or block traffic).
  5. Observe the client behavior.

What did you expect to see?

  • The client should retry failed connections with other resolved IPs.
  • The client should automatically switch to a reachable IP without requiring manual reconfiguration or restart.

What did you see instead?

  • The client attempts to connect only to one IP (usually the first one resolved).
  • If that IP is unavailable, the client does not switch to other available IPs, leading to connection failures.

Anything else?

  • This limits high availability when one backend node fails or becomes unreachable.
  • The Java client is able to handle domains with multiple IPs by retrying other addresses. Having the C++ client behave consistently would improve resiliency.
  • DNS resolution frequency and TTL may also affect the current behavior.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions