{"record":{"id":"ed2cd4761bc62f24","repo":"apache/seatunnel","slug":"error-closing-potentially-broken-client","errorCode":null,"errorMessage":"Error closing potentially broken client: {}","messagePattern":"Error closing potentially broken client: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-hugegraph/src/main/java/org/apache/seatunnel/connectors/seatunnel/hugegraph/client/HugeGraphClient.java","lineNumber":152,"sourceCode":"            } catch (Exception e) {\n                // Avoid leaking a partially-opened client (e.g. createPageApis failed after the\n                // HugeClient was created) — release everything before surfacing the failure.\n                reconnect();\n                throw new HugeGraphConnectorException(\n                        HugeGraphConnectorErrorCode.BUILD_CLIENT_FAILED,\n                        \"Failed to establish initial connection\",\n                        e);\n            }\n        }\n    }\n\n    private void reconnect() {\n        LOG.warn(\"Connection issue detected. Forcing reconnection...\");\n        if (this.client != null) {\n            try {\n                this.client.close();\n            } catch (Exception e) {\n                LOG.warn(\"Error closing potentially broken client: {}\", e.getMessage());\n            }\n        }\n        this.client = null;\n        if (this.restClient != null) {\n            try {\n                this.restClient.close();\n            } catch (Exception e) {\n                LOG.warn(\"Error closing potentially broken REST client: {}\", e.getMessage());\n            }\n        }\n        this.restClient = null;\n        this.vertexAPI = null;\n        this.edgeAPI = null;\n        this.schema = null;\n    }\n\n    private void createPageApis(HugeGraphConnectionConfig config) {\n        String url = buildServerUrl(config);","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hugegraph/src/main/java/org/apache/seatunnel/connectors/seatunnel/hugegraph/client/HugeGraphClient.java#L134-L170","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["No action usually needed: the broken client is discarded and a fresh one is created","If seen frequently, check for server-side connection killing (LB idle timeouts, firewall state expiry)","Increase client/connection timeouts in configuration so connections die cleanly rather than corrupt","Review root-cause exception that triggered the reconnect in earlier log lines"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// No caller action needed; the connector swallows and rebuilds the client.\n// If it recurs, catch it at the operation boundary:\ntry {\n    client.executeIdempotentWrite(op);\n} catch (Exception e) {\n    // inspect root cause that forced reconnect\n}","preventionTips":["Enable TCP keepalives and align LB idle timeouts to avoid half-dead sockets","Check for server-side abrupt connection termination under load","Ensure adequate JVM resources on workers so client shutdown succeeds","Correlate with the triggering exception in earlier log lines to fix the root cause"],"tags":["hugegraph","connection","resource-cleanup","client"],"backgroundTag":"broken-pipe","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}