{"record":{"id":"4263f2a8c6fe08ba","repo":"apache/iceberg","slug":"an-error-occurred-closing-catalog-instance-ignori","errorCode":null,"errorMessage":"An error occurred closing catalog instance, ignoring...","messagePattern":"An error occurred closing catalog instance, ignoring\\.\\.\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/IcebergSinkTask.java","lineNumber":78,"sourceCode":"  }\n\n  @Override\n  public void close(Collection<TopicPartition> partitions) {\n    committer.close(partitions);\n  }\n\n  private void close() {\n    if (committer != null) {\n      committer.close(List.of());\n      committer = null;\n    }\n\n    if (catalog != null) {\n      if (catalog instanceof AutoCloseable) {\n        try {\n          ((AutoCloseable) catalog).close();\n        } catch (Exception e) {\n          LOG.warn(\"An error occurred closing catalog instance, ignoring...\", e);\n        }\n      }\n      catalog = null;\n    }\n  }\n\n  @Override\n  public void put(Collection<SinkRecord> sinkRecords) {\n    if (committer != null) {\n      committer.save(sinkRecords);\n    }\n  }\n\n  @Override\n  public void flush(Map<TopicPartition, OffsetAndMetadata> currentOffsets) {\n    if (committer != null) {\n      committer.save(null);\n    }","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/IcebergSinkTask.java#L60-L96","documentation":"When a Kafka Connect Iceberg sink task stops, IcebergSinkTask.close() closes the configured Catalog if it implements AutoCloseable. Any exception thrown by catalog.close() is caught and logged at warn and deliberately ignored so the Connect task can shut down cleanly. The log is informational: catalog close failures here rarely matter because the task's writers have already been closed and flushed.","triggerScenarios":"Any Connect task stop/rebalance/shutdown where the configured catalog's close() throws — e.g. REST catalog's underlying HTTP client, Hadoop FileSystem close, or JDBC pool shutdown fails.","commonSituations":"Kafka Connect worker rebalance or graceful shutdown; Hadoop shutdown hook racing with close(); catalog client already closed by another component; network unreachable during final REST cleanup.","solutions":["Check the attached exception for the root cause (e.g. HTTP client or Hadoop close failure); it is usually benign.","If it recurs with side effects (connection leaks), upgrade catalog client libraries so close() is idempotent.","Ensure only one component closes shared Hadoop FileSystem / client instances; disable redundant shutdown hooks.","No action needed if it appears only at worker shutdown — this is an expected, suppressed warning."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"if (catalog instanceof AutoCloseable closable) {\n  // safe to close\n}","tryCatchPattern":"try {\n  ((AutoCloseable) catalog).close();\n} catch (Exception e) {\n  LOG.warn(\"catalog close failed during task shutdown; ignoring\", e);\n  // swallow intentionally — task state already flushed\n}","preventionTips":["Treat close-failures at task shutdown as non-fatal; flush writers before closing the catalog.","Keep catalog clients idempotent on close() by using current client library versions.","Avoid sharing one Hadoop FileSystem handle between components with competing shutdown hooks.","If leaks are suspected, enable connection-pool metrics on the catalog (REST/JDBC) instead of relying on close()."],"tags":["kafka-connect","catalog","shutdown","cleanup"],"backgroundTag":"resource-cleanup-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}