apache/iceberg · error · ConnectException

Coordinator ${taskId} is terminated, commit aborted

Error message

Coordinator ${taskId} is terminated, commit aborted

What it means

ConnectException raised in Coordinator.commitToTable just before writing accumulated data/delete files to a table, when the coordinator's terminated flag is set. It prevents committing against a coordinator that is shutting down, which could leave a partial or duplicated commit pipeline.

Source

Thrown at kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/Coordinator.java:299

    List<DataFile> dataFiles =
        payloads.stream()
            .filter(payload -> payload.dataFiles() != null)
            .flatMap(payload -> payload.dataFiles().stream())
            .filter(dataFile -> dataFile.recordCount() > 0)
            .filter(distinctByKey(ContentFile::location))
            .collect(Collectors.toList());

    List<DeleteFile> deleteFiles =
        payloads.stream()
            .filter(payload -> payload.deleteFiles() != null)
            .flatMap(payload -> payload.deleteFiles().stream())
            .filter(deleteFile -> deleteFile.recordCount() > 0)
            .filter(distinctByKey(ContentFile::location))
            .collect(Collectors.toList());

    if (terminated) {
      throw new ConnectException(
          String.format("Coordinator %s is terminated, commit aborted", taskId));
    }

    if (dataFiles.isEmpty() && deleteFiles.isEmpty()) {
      LOG.info(
          "Coordinator {} found nothing to commit to table {}, skipping", taskId, tableIdentifier);
    } else {
      if (deleteFiles.isEmpty()) {
        AppendFiles appendOp =
            table.newAppend().validateWith(offsetValidator(tableIdentifier, committedOffsets));
        if (branch != null) {
          appendOp.toBranch(branch);
        }
        appendOp.set(snapshotOffsetsProp, offsetsJson);
        appendOp.set(COMMIT_ID_SNAPSHOT_PROP, commitState.currentCommitId().toString());
        appendOp.set(TASK_ID_SNAPSHOT_PROP, taskId);
        if (validThroughTs != null) {
          appendOp.set(VALID_THROUGH_TS_SNAPSHOT_PROP, validThroughTs.toString());

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Rely on Kafka Connect's exactly-once redelivery: let the aborted commit be retried by the next coordinator incarnation.
  2. Reduce commit latency (smaller commit.interval.ms overlap windows, fewer files per commit) so commits finish before shutdown.
  3. Check for repeated occurrences: frequent termination races often indicate an operator or rebalance loop that should be fixed first.
  4. If deliberate shutdown, no action needed — this is expected abort-on-shutdown behavior.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  coordinator.doCommit();
} catch (ConnectException e) {
  if (String.valueOf(e.getMessage()).contains("is terminated, commit aborted")) {
    LOG.warn("Commit aborted due to shutdown; will be retried by next coordinator");
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: stop()/terminate() was invoked (task shutdown or rebalance) while the coordinator was still inside doCommit; the terminated flag is checked immediately before the table write, so commits racing shutdown abort.

Common situations: Long-running commits (many files, slow catalog) overlapping a Connect task rebalance or connector stop; operator restarts the connector while a commit is in flight.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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