apache/seatunnel · warning

Error closing potentially broken client: {}

Error message

Error closing potentially broken client: {}

What it means

Logged by HugeGraphClient.reconnect() when calling close() on the existing HugeClient throws. The error is deliberately swallowed because the client is presumed broken anyway; the message records why it could not be cleanly shut down. The client reference is then nulled and rebuilt on the next operation.

Source

Thrown at seatunnel-connectors-v2/connector-hugegraph/src/main/java/org/apache/seatunnel/connectors/seatunnel/hugegraph/client/HugeGraphClient.java:152

            } catch (Exception e) {
                // Avoid leaking a partially-opened client (e.g. createPageApis failed after the
                // HugeClient was created) — release everything before surfacing the failure.
                reconnect();
                throw new HugeGraphConnectorException(
                        HugeGraphConnectorErrorCode.BUILD_CLIENT_FAILED,
                        "Failed to establish initial connection",
                        e);
            }
        }
    }

    private void reconnect() {
        LOG.warn("Connection issue detected. Forcing reconnection...");
        if (this.client != null) {
            try {
                this.client.close();
            } catch (Exception e) {
                LOG.warn("Error closing potentially broken client: {}", e.getMessage());
            }
        }
        this.client = null;
        if (this.restClient != null) {
            try {
                this.restClient.close();
            } catch (Exception e) {
                LOG.warn("Error closing potentially broken REST client: {}", e.getMessage());
            }
        }
        this.restClient = null;
        this.vertexAPI = null;
        this.edgeAPI = null;
        this.schema = null;
    }

    private void createPageApis(HugeGraphConnectionConfig config) {
        String url = buildServerUrl(config);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. No action usually needed: the broken client is discarded and a fresh one is created
  2. If seen frequently, check for server-side connection killing (LB idle timeouts, firewall state expiry)
  3. Increase client/connection timeouts in configuration so connections die cleanly rather than corrupt
  4. Review root-cause exception that triggered the reconnect in earlier log lines
Defensive patterns

Strategy: retry

Try / catch

// No caller action needed; the connector swallows and rebuilds the client.
// If it recurs, catch it at the operation boundary:
try {
    client.executeIdempotentWrite(op);
} catch (Exception e) {
    // inspect root cause that forced reconnect
}

Prevention

When it happens

Trigger: reconnect() runs on a client whose underlying HTTP connection pool or driver is in a corrupt/closed state, so client.close() itself raises an exception while tearing down pooled connections.

Common situations: Server abruptly killed connections mid-request (half-closed sockets), JVM shutdown hooks interfering, or driver internals failing to release resources after a severe network fault.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/ed2cd4761bc62f24. Report an issue: GitHub.