{"record":{"id":"c0330ebdf3a8825a","repo":"apache/seatunnel","slug":"close-client-failed","errorCode":"CLOSE_CLIENT_FAILED","errorMessage":"Close Firestore client failed.","messagePattern":"Close Firestore client failed\\.","errorType":"error_code","errorClass":"FirestoreConnectorException","httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-google-firestore/src/main/java/org/apache/seatunnel/connectors/seatunnel/google/firestore/sink/FirestoreSinkWriter.java","lineNumber":79,"sourceCode":"                        .setCredentials(credentials)\n                        .build();\n        this.firestore = firestoreOptions.getService();\n        this.collectionReference = firestore.collection(parameters.getCollection());\n        this.serializer = new DefaultSeaTunnelRowSerializer(seaTunnelRowType);\n    }\n\n    @Override\n    public void write(SeaTunnelRow seaTunnelRow) throws IOException {\n        collectionReference.add(serializer.serialize(seaTunnelRow));\n    }\n\n    @Override\n    public void close() throws IOException {\n        if (firestore != null) {\n            try {\n                firestore.close();\n            } catch (Exception e) {\n                throw new FirestoreConnectorException(\n                        FirestoreConnectorErrorCode.CLOSE_CLIENT_FAILED,\n                        \"Close Firestore client failed.\",\n                        e);\n            }\n        }\n    }\n}\n","sourceCodeStart":61,"sourceCodeEnd":87,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-google-firestore/src/main/java/org/apache/seatunnel/connectors/seatunnel/google/firestore/sink/FirestoreSinkWriter.java#L61-L87","documentation":"FirestoreSinkWriter.close() wraps the Firestore client's own close() call; if firestore.close() throws for any reason, the writer rethrows it as a FirestoreConnectorException with code CLOSE_CLIENT_FAILED. This signals that gRPC channels/resources backing the Firestore client could not be shut down cleanly.","triggerScenarios":"Writer close() is invoked (task shutdown, job finish, failover) while firestore != null and the underlying Firestore client's close() throws — e.g. interrupted gRPC shutdown, already-aborted transport.","commonSituations":"Job cancellation with in-flight RPCs; network partitions at shutdown time; JVM shutdown hooks competing with the writer's close.","solutions":["Inspect the wrapped cause (the exception carries the original 'e') to identify the underlying transport problem.","Ensure the network to Firestore is stable at job teardown; retry the job if it was a transient shutdown race.","If it recurs on cancellation, upgrade the connector / gRPC version where shutdown races are fixed; it is usually harmless since the process is exiting anyway."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  writer.close();\n} catch (FirestoreConnectorException e) {\n  log.warn(\"Firestore client close failed (cause: {}). Resources will be reclaimed by JVM exit.\", e.getCause(), e);\n  // do not fail the whole job for a shutdown-time close error\n}","preventionTips":["Ensure stable network connectivity to Firestore during job teardown.","Avoid hard-cancelling jobs with large in-flight write batches.","Check the wrapped cause; repeated failures may indicate a gRPC version issue worth upgrading."],"tags":["firestore","sink","resource-cleanup"],"backgroundTag":"http-error-response","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"}