{"record":{"id":"0a764f65cc3a97d8","repo":"apache/seatunnel","slug":"failed-to-close-hugegraph-sink-writer","errorCode":null,"errorMessage":"Failed to close HugeGraph sink writer","messagePattern":"Failed to close HugeGraph sink writer","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hugegraph/src/main/java/org/apache/seatunnel/connectors/seatunnel/hugegraph/sink/HugeGraphSinkWriter.java","lineNumber":863,"sourceCode":"                if (client != null) {\n                    client.close();\n                }\n            } catch (Exception closeFailure) {\n                if (failure == null) {\n                    failure = closeFailure;\n                } else {\n                    failure.addSuppressed(closeFailure);\n                }\n            }\n        }\n        if (failure instanceof IOException) {\n            throw (IOException) failure;\n        }\n        if (failure instanceof RuntimeException) {\n            throw (RuntimeException) failure;\n        }\n        if (failure != null) {\n            throw new IOException(\"Failed to close HugeGraph sink writer\", failure);\n        }\n    }\n\n    /** Package-private test accessor. */\n    List<MappingEntry> mappingEntries() {\n        return mappingEntries;\n    }\n\n    static class MappingEntry {\n        final MappingConfig config;\n        final GraphDataMapper mapper;\n\n        MappingEntry(MappingConfig config, GraphDataMapper mapper) {\n            this.config = config;\n            this.mapper = mapper;\n        }\n    }\n}","sourceCodeStart":845,"sourceCodeEnd":881,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hugegraph/src/main/java/org/apache/seatunnel/connectors/seatunnel/hugegraph/sink/HugeGraphSinkWriter.java#L845-L881","documentation":"On close(), HugeGraphSinkWriter replays the first failure captured during earlier close steps (IO or runtime exceptions are rethrown as-is); any other non-null failure cause is wrapped in an IOException with this message. This ensures resource-cleanup failures are never silently swallowed during job shutdown.","triggerScenarios":"close() is called (by the engine or tests like testVertexInsert) and an exception was captured during resource cleanup that is neither IOException nor RuntimeException, so it is wrapped and rethrown as IOException(\"Failed to close HugeGraph sink writer\", failure).","commonSituations":"HugeGraph client/session cannot be released cleanly because the server is unreachable; thread interruption during close; an unexpected checked exception (neither IO nor Runtime) thrown by a cleanup routine.","solutions":["Inspect the 'Caused by' of the IOException to identify the original cleanup failure.","Ensure the HugeGraph client is reachable/releasable at shutdown; check server logs for session close errors.","Avoid interrupting the task thread while close() is executing.","If a new checked exception type is thrown by cleanup code, handle or wrap it appropriately rather than letting it surface here."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure server reachable before closing\n// curl -s http://HOST:PORT/apis/version >/dev/null","typeGuard":null,"tryCatchPattern":"try {\n  writer.close();\n} catch (IOException e) {\n  LOG.error(\"HugeGraph writer close failed\", e.getCause());\n}","preventionTips":["Always call close() in a finally block or use try-with-resources.","Do not interrupt worker threads during shutdown.","Check the 'Caused by' chain for the root cleanup failure.","Keep HugeGraph client sessions short-lived and closed deterministically."],"tags":["sink","close","ioexception","resource-cleanup"],"backgroundTag":"file-write-failed","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"}