apache/iceberg · error · RuntimeException
Interrupted in call to listViews
Error message
Interrupted in call to listViews
What it means
listViews() catches InterruptedException, restores the thread's interrupt flag via Thread.currentThread().interrupt(), and rethrows as a RuntimeException with this message. It means the thread was interrupted while waiting on the Hive Metastore call.
Source
Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:233
// 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) {
filteredTableIdentifiers.addAll(
listIcebergTables(viewNameSet, namespace, HiveOperationsBase.ICEBERG_VIEW_TYPE_VALUE));
}
return filteredTableIdentifiers;
} catch (UnknownDBException e) {
throw new NoSuchNamespaceException("Namespace does not exist: %s", namespace);
} catch (TException e) {
throw new RuntimeException("Failed to list all views under namespace " + namespace, e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("Interrupted in call to listViews", e);
}
}
@Override
public String name() {
return name;
}
@Override
public boolean dropTable(TableIdentifier identifier, boolean purge) {
if (!isValidIdentifier(identifier)) {
return false;
}
String database = identifier.namespace().level(0);
TableOperations ops = newTableOps(identifier);
TableMetadata lastMetadata = null;View on GitHub (pinned to 86d9c8fc54)
Solutions
- Treat the interruption as a cancellation signal: stop processing and propagate/cleanup.
- Inspect the calling executor's lifecycle — why was shutdown/cancel issued.
- Adjust timeout/cancellation settings if interruption is unintentional.
- Never swallow InterruptedException; this code already re-interrupts, so rethrow appropriately.
Example fix
// before
try { views = catalog.listViews(ns); } catch (RuntimeException e) { e.printStackTrace(); }
// after
try {
views = catalog.listViews(ns);
} catch (RuntimeException e) {
if (Thread.currentThread().isInterrupted() || e.getCause() instanceof InterruptedException) {
Thread.currentThread().interrupt();
throw e; // propagate cancellation
}
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
if (Thread.currentThread().isInterrupted()) {
throw new InterruptedException("Interrupted before listing views");
} Try / catch
try {
views = catalog.listViews(ns);
} catch (RuntimeException e) {
if (e.getCause() instanceof InterruptedException) {
Thread.currentThread().interrupt();
throw e; // treat as cancellation
}
throw e;
} Prevention
- Avoid interrupting threads during catalog cleanup; use cooperative cancellation.
- Order executor shutdown so metadata operations complete before shutdownNow().
- Never swallow InterruptedException without restoring the interrupt flag.
When it happens
Trigger: Calling catalog.listViews(namespace) from a thread that is interrupted (executor shutdownNow, task cancellation, Spark/Flink task kill) while the metastore RPC is in flight.
Common situations: Cancelling a Spark job or Flink tasklet that was enumerating views; shutting down a thread pool; query timeouts implemented via thread interruption.
Related errors
- Interrupted in call to dropView
- Interrupted in call to dropTable
- Interrupted in call to createDatabase(name) ${namespace} in
- Interrupted in SQL query
- Interrupted during commit
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/135654b774a7adda.
Report an issue: GitHub.