Skip to content

[Bug] ControlledClusterFailover.close loses the underlying exception #25898

@PavelZeger

Description

@PavelZeger

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

Client Java

Issue Description

pulsar-client/src/main/java/org/apache/pulsar/client/impl/ControlledClusterFailover.java:

@Override
public void close() {
    this.executor.shutdown();
    if (httpClient != null) {
        try {
            httpClient.close();
        } catch (IOException e) {
            log.error("Failed to close http client.");
        }
    }
}

The IOException e is captured but never logged.

When the HTTP client fails to close (which happens on socket leaks, half-closed connections, or shutdown races), the operator sees one line:

ERROR ...ControlledClusterFailover - Failed to close http client.

and no information about what went wrong. The IOException could be:

  • SocketTimeoutException - the connection didn't drain in time.
  • IOException("Connection reset") - the proxy dropped us.
  • IOException("Idle eviction failed") - an internal Jetty error.

All three suggest different remedies, and the operator can't tell which without enabling DEBUG logs.
When a client transitions away from a cluster, this close() runs. Diagnostic information here is the only signal an operator has that the failover happened cleanly.

Error messages


Reproducing the issue

N/A

Additional information

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions