{"record":{"id":"4c8fbbc75207232a","repo":"apache/seatunnel","slug":"failed-to-close-neo4j-source-reader","errorCode":null,"errorMessage":"Failed to close Neo4j source reader.","messagePattern":"Failed to close Neo4j source reader\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-neo4j/src/main/java/org/apache/seatunnel/connectors/seatunnel/neo4j/source/Neo4jSourceReader.java","lineNumber":122,"sourceCode":"        }\n    }\n\n    private Throwable appendSuppressed(Throwable existingFailure, Throwable newFailure) {\n        if (existingFailure == null) {\n            return newFailure;\n        }\n        existingFailure.addSuppressed(newFailure);\n        return existingFailure;\n    }\n\n    private void rethrowCloseFailure(Throwable throwable) throws IOException {\n        if (throwable instanceof IOException) {\n            throw (IOException) throwable;\n        }\n        if (throwable instanceof RuntimeException) {\n            throw (RuntimeException) throwable;\n        }\n        throw new IOException(\"Failed to close Neo4j source reader.\", throwable);\n    }\n\n    @Override\n    public void internalPollNext(Collector<SeaTunnelRow> output) throws Exception {\n        try {\n            for (Neo4jSourceTableConfig tableConfig : tableConfigs) {\n                readTable(output, tableConfig);\n            }\n        } finally {\n            this.context.signalNoMoreElement();\n        }\n    }\n\n    private void readTable(Collector<SeaTunnelRow> output, Neo4jSourceTableConfig tableConfig) {\n        final Query query = new Query(tableConfig.getQuery());\n        try {\n            session.readTransaction(\n                    tx -> {","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-neo4j/src/main/java/org/apache/seatunnel/connectors/seatunnel/neo4j/source/Neo4jSourceReader.java#L104-L140","documentation":"When closing the Neo4j source reader, an exception occurred that is neither an IOException nor a RuntimeException (e.g. a checked exception from driver/session close). rethrowCloseFailure wraps it in an IOException with this message and the original as cause, so the framework's close() contract is preserved.","triggerScenarios":"close() on Neo4jSourceReader fails; the underlying driver session or resources throw a checked/non-Runtime exception, which rethrowCloseFailure wraps into IOException(\"Failed to close Neo4j source reader.\").","commonSituations":"Network drop to Neo4j while closing the Bolt session; driver-level resource cleanup failure at job teardown; interrupt during close.","solutions":["Inspect the cause chain of the IOException for the root driver error.","Verify Neo4j connectivity and that the server is not shutting down during job teardown.","Upgrade the Neo4j Java driver if close() reliably throws known driver bugs."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  reader.close();\n} catch (IOException e) {\n  if (e.getCause() != null) log.error(\"Neo4j reader close root cause\", e.getCause());\n  // job is ending; log and continue teardown\n}","preventionTips":["Ensure stable network to Neo4j during job teardown.","Avoid stopping the Neo4j server while jobs are running.","Inspect cause chains; close failures usually mask a driver-level issue."],"tags":["neo4j","resource-cleanup","io"],"backgroundTag":"internal-invariant-violation","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"}