{"record":{"id":"eea4b230f0b14e66","repo":"apache/iceberg","slug":"interrupted-during-commit-eea4b2","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/HiveCatalog.java","lineNumber":780,"sourceCode":"    try {\n      Database databaseData =\n          clients.run(client -> client.getDatabase(tableIdentifier.namespace().levels()[0]));\n      if (databaseData.getLocationUri() != null) {\n        // If the database location is set use it as a base.\n        String databaseLocation = LocationUtil.stripTrailingSlash(databaseData.getLocationUri());\n        return String.format(\"%s/%s\", databaseLocation, tableLocation);\n      }\n\n    } catch (NoSuchObjectException e) {\n      throw new NoSuchNamespaceException(\n          e, \"Namespace does not exist: %s\", tableIdentifier.namespace().levels()[0]);\n    } catch (TException e) {\n      throw new RuntimeException(\n          String.format(\"Metastore operation failed for %s\", tableIdentifier), e);\n\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new RuntimeException(\"Interrupted during commit\", e);\n    }\n\n    // Otherwise, stick to the {WAREHOUSE_DIR}/{DB_NAME}.db/{TABLE_NAME} path\n    String databaseLocation = databaseLocation(tableIdentifier.namespace().levels()[0]);\n    return String.format(\"%s/%s\", databaseLocation, tableLocation);\n  }\n\n  private String databaseLocation(String databaseName) {\n    String warehouseLocation = conf.get(HiveConf.ConfVars.METASTOREWAREHOUSE.varname);\n    Preconditions.checkNotNull(\n        warehouseLocation, \"Warehouse location is not set: hive.metastore.warehouse.dir=null\");\n    warehouseLocation = LocationUtil.stripTrailingSlash(warehouseLocation);\n    return String.format(\"%s/%s.db\", warehouseLocation, databaseName);\n  }\n\n  private Map<String, String> convertToMetadata(Database database) {\n\n    Map<String, String> meta = Maps.newHashMap();","sourceCodeStart":762,"sourceCodeEnd":798,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java#L762-L798","documentation":"Thrown by defaultWarehouseLocation when the thread is interrupted while waiting for a metastore client during default table-location resolution. The handler restores the interrupt flag before wrapping the exception in a RuntimeException (message text is a legacy carry-over from the commit path). It indicates deliberate cancellation, not a metastore fault.","triggerScenarios":"Interrupt delivered during clients.run in defaultWarehouseLocation, typically while creating a table from a thread being cancelled or shut down.","commonSituations":"Executor shutdown mid-table-creation; Spark/Flink task cancellation; test harness timeouts interrupting the caller.","solutions":["Treat as cancellation: stop the operation or rerun after the interrupting condition is resolved.","Don't schedule table creation on threads managed by short-lived executors that shut down eagerly.","Investigate which component issues the interrupt if it is unexpected."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (Thread.currentThread().isInterrupted()) { /* do not start table creation */ }","typeGuard":null,"tryCatchPattern":"try {\n  catalog.createTable(ident, schema);\n} catch (RuntimeException e) {\n  if (e.getCause() instanceof InterruptedException) { /* cancelled: clean up and stop */ }\n  throw e;\n}","preventionTips":["Run table creation on threads that are not cancelled mid-flight","Handle executor shutdown before issuing metadata mutations","Retain idempotent create flows so cancelled attempts can be safely retried"],"tags":["hive-metastore","interrupted","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-23T08:17:48.524Z"}