apache/iceberg · error · RuntimeException

Interrupted in call to listTables

Error message

Interrupted in call to listTables

What it means

HiveCatalog.listTables() throws RuntimeException("Interrupted in call to listTables") when the thread waiting on the Hive metastore call (via the client pool) is interrupted. The handler restores the interrupt flag before throwing so callers can observe cancellation.

Source

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

            listIcebergTablesByFilter(
                namespace, BaseMetastoreTableOperations.ICEBERG_TABLE_TYPE_VALUE);
      }

      LOG.debug(
          "Listing of namespace: {} resulted in the following tables: {}",
          namespace,
          tableIdentifiers);
      return tableIdentifiers;

    } catch (UnknownDBException e) {
      throw new NoSuchNamespaceException("Namespace does not exist: %s", namespace);

    } catch (TException e) {
      throw new RuntimeException("Failed to list all tables under namespace " + namespace, e);

    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new RuntimeException("Interrupted in call to listTables", e);
    }
  }

  @Override
  public List<TableIdentifier> listViews(Namespace namespace) {
    Preconditions.checkArgument(
        isValidateNamespace(namespace), "Missing database in namespace: %s", namespace);

    try {
      String database = namespace.level(0);
      List<String> viewNames =
          clients.run(client -> client.getTables(database, "*", TableType.VIRTUAL_VIEW));

      // Retrieving the Table objects from HMS in batches to avoid OOM
      List<TableIdentifier> filteredTableIdentifiers = Lists.newArrayList();
      Iterable<List<String>> viewNameSets = Iterables.partition(viewNames, 100);

      for (List<String> viewNameSet : viewNameSets) {

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Avoid interrupting catalog calls during normal operation; cancel work at a coarser level
  2. If intentional shutdown, catch RuntimeException and treat as cancellation
  3. Ensure timeouts are configured at the metastore/client level instead of interrupting threads
  4. Re-check the restored interrupt flag in calling code and exit promptly

Example fix

// before
executor.shutdownNow(); // interrupts in-flight listTables
// after
executor.shutdown();
executor.awaitTermination(60, TimeUnit.SECONDS); // let HMS calls finish
Defensive patterns

Strategy: try-catch

Try / catch

try { catalog.listTables(ns); } catch (RuntimeException e) { if (Thread.currentThread().isInterrupted()) { /* treat as cancellation, exit */ } }

Prevention

When it happens

Trigger: The thread calling listTables() is interrupted while blocked waiting for an HMS client from CachedClientPool or for the metastore round-trip — e.g. task cancellation, query kill, or executor shutdown.

Common situations: Spark/Flink job cancelled while listing tables; executor shutdown with tasks in-flight; timeouts implemented via thread interruption; shutdown hooks interrupting workers.

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/e5b4fb2d32c46f1e. Report an issue: GitHub.