{"record":{"id":"582e0581052bee3e","repo":"apache/seatunnel","slug":"error-closing-potentially-broken-rest-client","errorCode":null,"errorMessage":"Error closing potentially broken REST client: {}","messagePattern":"Error closing potentially broken REST 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":160,"sourceCode":"            }\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);\n        String graphSpace =\n                config.getGraphSpace() != null ? config.getGraphSpace() : DEFAULT_GRAPH_SPACE;\n        RestClientConfig restClientConfig =\n                RestClientConfig.builder()\n                        .user(config.getUsername() == null ? \"\" : config.getUsername())\n                        .password(config.getPassword() == null ? \"\" : config.getPassword())\n                        .build();\n        this.restClient = new RestClient(url, restClientConfig);","sourceCodeStart":142,"sourceCodeEnd":178,"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#L142-L178","documentation":"Logged by HugeGraphClient.reconnect() when closing the underlying RestClient throws an exception. As with the primary client, the error is swallowed, restClient and all derived API/schema references are nulled, and a fresh client is built on the next operation. It indicates the REST layer was in an unrecoverable state.","triggerScenarios":"restClient.close() fails during reconnect after a connection-level error — typically because the low-level HTTP client's I/O reactor is already shut down or its selector is in a bad state after a socket error.","commonSituations":"Sudden server termination mid-request, I/O reactor shutdown due to a fatal network error, or JVM resource exhaustion preventing clean HTTP client shutdown.","solutions":["Usually benign: the client is rebuilt after reconnect, no user action required","If persistent, restart the SeaTunnel worker/node to clear any broken I/O reactor state","Check HugeGraph server logs around the same timestamp for crashes or OOM","Tune connection/timeout settings to avoid abrupt socket teardowns"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Benign after reconnect; escalate only if writes ultimately fail:\ntry {\n    sinkWrite();\n} catch (HugeGraphConnectorException e) {\n    // BUILD_CLIENT_FAILED after retries -> check server/I/O reactor health\n    throw e;\n}","preventionTips":["Keep HugeGraph server stable; investigate crashes/OOM at matching timestamps","Restart stale workers if I/O reactor corruption recurs","Tune HTTP client timeouts to avoid abrupt reactor shutdowns","Monitor connection churn between workers and server"],"tags":["hugegraph","connection","http-client","resource-cleanup"],"backgroundTag":"broken-pipe","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}