{"record":{"id":"62007cc274ce6e19","repo":"apache/iceberg","slug":"interrupted-in-call-to-getalldatabases-namespac","errorCode":null,"errorMessage":"Interrupted in call to getAllDatabases() <namespace> in Hive Metastore","messagePattern":"Interrupted in call to getAllDatabases\\(\\) <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":587,"sourceCode":"    if (!namespace.isEmpty()) {\n      return ImmutableList.of();\n    }\n    try {\n      List<Namespace> namespaces =\n          clients.run(IMetaStoreClient::getAllDatabases).stream()\n              .map(Namespace::of)\n              .collect(Collectors.toList());\n\n      LOG.debug(\"Listing namespace {} returned tables: {}\", namespace, namespaces);\n      return namespaces;\n\n    } catch (TException e) {\n      throw new RuntimeException(\n          \"Failed to list all namespace: \" + namespace + \" in Hive Metastore\", e);\n\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new RuntimeException(\n          \"Interrupted in call to getAllDatabases() \" + namespace + \" in Hive Metastore\", e);\n    }\n  }\n\n  @Override\n  public boolean dropNamespace(Namespace namespace) {\n    if (!isValidateNamespace(namespace)) {\n      return false;\n    }\n\n    try {\n      clients.run(\n          client -> {\n            client.dropDatabase(\n                namespace.level(0),\n                false /* deleteData */,\n                false /* ignoreUnknownDb */,\n                false /* cascade */);","sourceCodeStart":569,"sourceCodeEnd":605,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java#L569-L605","documentation":"listNamespaces restores the interrupt flag and throws a RuntimeException when the thread is interrupted while waiting for the metastore getAllDatabases() call. The listing was aborted because of interruption, not a metastore error.","triggerScenarios":"Thread executing catalog.listNamespaces() is interrupted during the metastore call (job cancellation, executor shutdown, watchdog timeout).","commonSituations":"Spark/Flink task cancel while planning; application shutdown interrupting catalog threads; scheduler-imposed timeouts.","solutions":["Gracefully shut down (allow the call to complete) instead of shutdownNow()","If cancellation is intended, catch the RuntimeException and clean up; the interrupt flag is restored so cancellation propagates","Re-check job orchestration timeouts that interrupt rather than cancel threads"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (Thread.currentThread().isInterrupted()) {\n  throw new InterruptedException(\"Skipping listNamespaces: already interrupted\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  return catalog.listNamespaces();\n} catch (RuntimeException e) {\n  if (Thread.currentThread().isInterrupted()) { return Collections.emptyList(); }\n  throw e;\n}","preventionTips":["Graceful shutdown over shutdownNow","Treat interrupted listings as cancellation, not metastore failure","Avoid interrupt-based timeouts around catalog calls"],"tags":["interruption","threading","listing"],"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"}