{"record":{"id":"61e28be619e23ce0","repo":"apache/iceberg","slug":"interrupted-in-call-to-drop-dropdatabase-name-na","errorCode":null,"errorMessage":"Interrupted in call to drop dropDatabase(name) <namespace> in Hive Metastore","messagePattern":"Interrupted in call to drop dropDatabase\\(name\\) <namespace> in Hive Metastore","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java","lineNumber":624,"sourceCode":"            return null;\n          });\n\n      LOG.info(\"Dropped namespace: {}\", namespace);\n      return true;\n\n    } catch (InvalidOperationException e) {\n      throw new NamespaceNotEmptyException(\n          e, \"Namespace %s is not empty. One or more tables exist.\", namespace);\n\n    } catch (NoSuchObjectException e) {\n      return false;\n\n    } catch (TException e) {\n      throw new RuntimeException(\"Failed to drop namespace \" + namespace + \" in Hive Metastore\", e);\n\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new RuntimeException(\n          \"Interrupted in call to drop dropDatabase(name) \" + namespace + \" in Hive Metastore\", e);\n    }\n  }\n\n  @Override\n  public boolean setProperties(Namespace namespace, Map<String, String> properties) {\n    Preconditions.checkArgument(\n        (properties.get(HMS_DB_OWNER_TYPE) == null) == (properties.get(HMS_DB_OWNER) == null),\n        \"Setting %s and %s has to be performed together or not at all\",\n        HMS_DB_OWNER_TYPE,\n        HMS_DB_OWNER);\n    Map<String, String> parameter = Maps.newHashMap();\n\n    parameter.putAll(loadNamespaceMetadata(namespace));\n    parameter.putAll(properties);\n    Database database = convertToDatabase(namespace, parameter);\n\n    alterHiveDataBase(namespace, database);","sourceCodeStart":606,"sourceCodeEnd":642,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java#L606-L642","documentation":"dropNamespace restores the interrupt flag and throws a RuntimeException when the thread is interrupted during the metastore dropDatabase call. The drop may or may not have completed; the exception reflects cancellation, not metastore failure.","triggerScenarios":"Thread executing catalog.dropNamespace(...) is interrupted while the dropDatabase call runs (job cancel, shutdown, timeout watchdog).","commonSituations":"Cancelling a cleanup job mid-drop; application shutdown during namespace teardown; orchestration timeouts interrupting threads.","solutions":["Use graceful shutdown so in-flight drops complete before interruption","After catching it, verify with namespaceExists whether the database was actually dropped before retrying","If cancellation was intended, exit cleanly — the interrupt flag is already restored"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (Thread.currentThread().isInterrupted()) {\n  throw new InterruptedException(\"Skipping dropNamespace: already interrupted\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  catalog.dropNamespace(ns, false);\n} catch (RuntimeException e) {\n  if (Thread.currentThread().isInterrupted()) {\n    // verify actual drop state before retry\n    if (catalog.namespaceExists(ns)) { /* retry later */ }\n    return;\n  }\n  throw e;\n}","preventionTips":["Use graceful shutdown during teardown jobs","After interruption, check namespaceExists before re-dropping","Avoid interrupting drop operations mid-flight"],"tags":["interruption","threading","drop"],"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"}