apache/iceberg · error · RuntimeException

Interrupted in call to getAllDatabases()

Error message

Interrupted in call to getAllDatabases() <namespace> in Hive Metastore

What it means

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.

Solutions

  1. Gracefully shut down (allow the call to complete) instead of shutdownNow()
  2. If cancellation is intended, catch the RuntimeException and clean up; the interrupt flag is restored so cancellation propagates
  3. Re-check job orchestration timeouts that interrupt rather than cancel threads
Defensive patterns

Strategy: try-catch

Validate before calling

if (Thread.currentThread().isInterrupted()) {
  throw new InterruptedException("Skipping listNamespaces: already interrupted");
}

Try / catch

try {
  return catalog.listNamespaces();
} catch (RuntimeException e) {
  if (Thread.currentThread().isInterrupted()) { return Collections.emptyList(); }
  throw e;
}

Prevention

When it happens

Trigger: Thread executing catalog.listNamespaces() is interrupted during the metastore call (job cancellation, executor shutdown, watchdog timeout).

Common situations: Spark/Flink task cancel while planning; application shutdown interrupting catalog threads; scheduler-imposed timeouts.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/62007cc274ce6e19. Report an issue: GitHub.

Appendix: source

Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:587

    if (!namespace.isEmpty()) {
      return ImmutableList.of();
    }
    try {
      List<Namespace> namespaces =
          clients.run(IMetaStoreClient::getAllDatabases).stream()
              .map(Namespace::of)
              .collect(Collectors.toList());

      LOG.debug("Listing namespace {} returned tables: {}", namespace, namespaces);
      return namespaces;

    } catch (TException e) {
      throw new RuntimeException(
          "Failed to list all namespace: " + namespace + " in Hive Metastore", e);

    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new RuntimeException(
          "Interrupted in call to getAllDatabases() " + namespace + " in Hive Metastore", e);
    }
  }

  @Override
  public boolean dropNamespace(Namespace namespace) {
    if (!isValidateNamespace(namespace)) {
      return false;
    }

    try {
      clients.run(
          client -> {
            client.dropDatabase(
                namespace.level(0),
                false /* deleteData */,
                false /* ignoreUnknownDb */,
                false /* cascade */);

View on GitHub (pinned to 86d9c8fc54)