apache/iceberg · info

An error occurred closing catalog instance, ignoring...

Error message

An error occurred closing catalog instance, ignoring...

What it means

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.

Source

Thrown at kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/IcebergSinkTask.java:78

  }

  @Override
  public void close(Collection<TopicPartition> partitions) {
    committer.close(partitions);
  }

  private void close() {
    if (committer != null) {
      committer.close(List.of());
      committer = null;
    }

    if (catalog != null) {
      if (catalog instanceof AutoCloseable) {
        try {
          ((AutoCloseable) catalog).close();
        } catch (Exception e) {
          LOG.warn("An error occurred closing catalog instance, ignoring...", e);
        }
      }
      catalog = null;
    }
  }

  @Override
  public void put(Collection<SinkRecord> sinkRecords) {
    if (committer != null) {
      committer.save(sinkRecords);
    }
  }

  @Override
  public void flush(Map<TopicPartition, OffsetAndMetadata> currentOffsets) {
    if (committer != null) {
      committer.save(null);
    }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Check the attached exception for the root cause (e.g. HTTP client or Hadoop close failure); it is usually benign.
  2. If it recurs with side effects (connection leaks), upgrade catalog client libraries so close() is idempotent.
  3. Ensure only one component closes shared Hadoop FileSystem / client instances; disable redundant shutdown hooks.
  4. No action needed if it appears only at worker shutdown — this is an expected, suppressed warning.
Defensive patterns

Strategy: try-catch

Type guard

if (catalog instanceof AutoCloseable closable) {
  // safe to close
}

Try / catch

try {
  ((AutoCloseable) catalog).close();
} catch (Exception e) {
  LOG.warn("catalog close failed during task shutdown; ignoring", e);
  // swallow intentionally — task state already flushed
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/4263f2a8c6fe08ba. Report an issue: GitHub.