{"record":{"id":"302286edaafb1d20","repo":"apache/iceberg","slug":"close-unexpectedly-called-on-committer-without","errorCode":null,"errorMessage":"Close unexpectedly called on committer {} without partition assignment","messagePattern":"Close unexpectedly called on committer (.+?) without partition assignment","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/CommitterImpl.java","lineNumber":167,"sourceCode":"      startCoordinator();\n    }\n  }\n\n  @Override\n  public void stop() {\n    throw new UnsupportedOperationException(\n        \"The method stop() is deprecated and will be removed in 2.0.0. \"\n            + \"Use stop(Collection<TopicPartition>) instead.\");\n  }\n\n  @Override\n  public void close(Collection<TopicPartition> closedPartitions) {\n    // Always try to stop the worker to avoid duplicates.\n    stopWorker();\n\n    // Defensive: close called without prior initialization (should not happen).\n    if (!isInitialized.get()) {\n      LOG.warn(\"Close unexpectedly called on committer {} without partition assignment\", taskId);\n      return;\n    }\n\n    // Empty partitions → task was stopped explicitly. Stop coordinator if running.\n    if (closedPartitions.isEmpty()) {\n      LOG.info(\"Committer {} stopped. Closing coordinator.\", taskId);\n      stopCoordinator();\n      return;\n    }\n\n    // Normal close: if leader partition is lost, stop coordinator.\n    if (hasLeaderPartition(closedPartitions)) {\n      LOG.info(\"Committer {} lost leader partition. Stopping coordinator.\", taskId);\n      stopCoordinator();\n    }\n\n    // Reset offsets to last committed to avoid data loss.\n    LOG.info(\"Seeking to last committed offsets for worker {}.\", taskId);","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/CommitterImpl.java#L149-L185","documentation":"CommitterImpl.close was called before the task was ever initialized with a partition assignment. This is defensively tolerated (worker is still stopped) and logged as a warning, because closing an uninitialized committer indicates an unexpected SourceTask lifecycle from the Connect framework.","triggerScenarios":"Kafka Connect calls close() on the committer task that was never opened()/initialized — e.g. task failed during start before assignment, or immediate task shutdown after configuration.","commonSituations":"Task startup aborted early due to config errors, so close follows without initialization; rapid task reconfiguration by the Connect worker; framework edge cases during worker shutdown.","solutions":["Usually safe to ignore — close() stops the worker and returns; no state corruption occurs.","If it appears at every startup, check the task log above for a start()-time exception (e.g. catalog/auth failure) that prevented initialization.","Validate the connector configuration (catalog properties, topics, table settings) so the task initializes on first attempt.","Upgrade the connector if your Connect runtime invokes close() during failed startup in a way that repeatedly triggers this."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// validate connector config up front so the task initializes on first attempt\n// (catalog properties, topics, routes, table identifiers)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fix any start()-time exceptions in task logs; they cause uninitialized close() calls.","Validate catalog credentials and table configuration before deploying.","Avoid rapid task reconfiguration cycles.","One-off occurrences are harmless — the code stops the worker defensively."],"tags":["kafka-connect","lifecycle","committer"],"backgroundTag":"invalid-state-transition","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}