{"record":{"id":"0fa8a5df1197ad1d","repo":"apache/iceberg","slug":"interrupted-during-commit-0fa8a5","errorCode":null,"errorMessage":"Interrupted during commit","messagePattern":"Interrupted during commit","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java","lineNumber":258,"sourceCode":"                newMetadataLocation,\n                metadata.properties(),\n                () -> checkCurrentMetadataLocation(newMetadataLocation));\n        switch (commitStatus) {\n          case SUCCESS:\n            break;\n          case FAILURE:\n            throw e;\n          case UNKNOWN:\n            throw new CommitStateUnknownException(e);\n        }\n      }\n    } catch (TException e) {\n      throw new RuntimeException(\n          String.format(\"Metastore operation failed for %s.%s\", database, viewName), e);\n\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new RuntimeException(\"Interrupted during commit\", e);\n\n    } catch (LockException e) {\n      throw new CommitFailedException(e);\n\n    } finally {\n      HiveOperationsBase.cleanupMetadataAndUnlock(io(), commitStatus, newMetadataLocation, lock);\n    }\n\n    LOG.info(\n        \"Committed to view {} with the new metadata location {}\", fullName, newMetadataLocation);\n  }\n\n  /**\n   * Validate if the new metadata location is the current metadata location.\n   *\n   * @param newMetadataLocation newly written metadata location\n   * @return true if the new metadata location is the current metadata location\n   */","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java#L240-L276","documentation":"The commit thread was interrupted while committing the view to the Hive metastore. Iceberg restores the interrupt flag and throws a RuntimeException. Interruption typically comes from task cancellation (e.g. Spark killing a task) or JVM shutdown.","triggerScenarios":"Thread interrupted (Thread.interrupt) during doCommit's metastore calls or lock acquisition; Spark/Flink task cancellation; executor shutdown mid-commit.","commonSituations":"Spark speculative execution or stage cancellation during a write; application shutdown with in-flight commits; timeouts in orchestration frameworks that cancel tasks.","solutions":["Find what interrupted the thread (task cancellation, shutdown hook) and avoid cancelling during commits.","Re-run the write after cancellation; check whether the commit landed (commit state may be uncertain).","If commit state is ambiguous, verify the current metadata location in the metastore before re-committing."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  view.updateSQL()...commit();\n} catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Interrupted during commit\")) {\n    Thread.interrupted(); // decide policy; check whether the commit actually landed\n  }\n  throw e;\n}","preventionTips":["Avoid cancelling Spark/Flink tasks in the middle of commits.","Size job timeouts so commits are not interrupted by orchestration kill signals.","After an interruption, verify the metastore's metadata_location before re-committing."],"tags":["hive","interruption","commit","threading"],"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"}