{"record":{"id":"e6f40b179cb54ce9","repo":"apache/iceberg","slug":"interrupted-while-waiting-for-coordinator-shutdown","errorCode":null,"errorMessage":"Interrupted while waiting for coordinator shutdown","messagePattern":"Interrupted while waiting for coordinator shutdown","errorType":"exception","errorClass":"ConnectException","httpStatus":null,"severity":"error","filePath":"kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/Coordinator.java","lineNumber":440,"sourceCode":"    }\n  }\n\n  long partialCommitFailureCount() {\n    return partialCommitFailures.get();\n  }\n\n  void terminate() {\n    this.terminated = true;\n\n    exec.shutdownNow();\n\n    // wait for coordinator termination, else cause the sink task to fail\n    try {\n      if (!exec.awaitTermination(1, TimeUnit.MINUTES)) {\n        throw new ConnectException(\"Timed out waiting for coordinator shutdown\");\n      }\n    } catch (InterruptedException e) {\n      throw new ConnectException(\"Interrupted while waiting for coordinator shutdown\", e);\n    }\n  }\n}\n","sourceCodeStart":422,"sourceCodeEnd":444,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/Coordinator.java#L422-L444","documentation":"Coordinator.terminate()'s awaitTermination(1, TimeUnit.MINUTES) can throw InterruptedException if the thread waiting for the coordinator to shut down is itself interrupted; it is rethrown as ConnectException with the interrupted thread chained as the cause so shutdown failure surfaces clearly.","triggerScenarios":"The thread calling Coordinator.terminate() (a Kafka Connect worker thread) receives an interrupt — usually because Connect is force-stopping the task after a prior shutdown timeout or during connector/task cancellation.","commonSituations":"Connect task cancellation cascades: first a timeout, then an interrupt while a second shutdown attempt waits; task.restart during rebalance interrupting the in-progress terminate() call.","solutions":["Inspect the chained cause to identify which thread was interrupted and why Connect issued the interrupt.","Check the earlier shutdown attempt — a prior timeout usually precedes the interrupt; address the underlying coordinator hang.","Ensure the coordinator completes promptly (fix slow catalog access, large commits) so terminate() finishes before Connect escalates to interrupts.","If this appears in logs during connector deletion or forced task kill, it is expected escalation; no code change needed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  coordinator.stop(true);\n} catch (ConnectException e) {\n  if (e.getCause() instanceof InterruptedException) {\n    Thread.currentThread().interrupt(); // preserve interrupt status\n    LOG.warn(\"Interrupted while awaiting coordinator shutdown (task cancellation)\", e);\n  } else {\n    throw e;\n  }\n}","preventionTips":["Fix prior shutdown timeouts — interrupts are Connect's escalation after them","Avoid frequent connector restart/cancel churn during commit windows","Always restore the thread interrupt flag when catching InterruptedException in wrappers"],"tags":["kafka-connect","coordinator","interrupted","shutdown"],"backgroundTag":"request-timeout","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"}