apache/iceberg · error · RuntimeException
Interrupted in call to getDatabase(name)
Error message
Interrupted in call to getDatabase(name) <namespace> in Hive Metastore
What it means
Thrown by HiveCatalog.alterHiveDataBase when the thread is interrupted while waiting for a Hive Metastore client via the connection pool. The handler re-interrupts the current thread (restoring the interrupt flag) before throwing, so interruption is not swallowed. It means the caller (or an executor shutting down) cancelled the operation.
Solutions
- Find and remove the code that interrupts the thread (executor shutdown, timeout framework) or don't run catalog ops in interruptible contexts.
- If intentional cancellation, treat this as expected and stop further catalog work.
- Re-run the operation in a fresh, non-interrupted thread after confirming shutdown is not in progress.
Defensive patterns
Strategy: try-catch
Validate before calling
if (Thread.currentThread().isInterrupted()) {
throw new IllegalStateException("Thread already interrupted; skipping catalog update");
} Try / catch
try {
catalog.setProperties(ns, props);
} catch (RuntimeException e) {
if (e.getCause() instanceof InterruptedException) { /* treat as cancellation, stop work */ }
throw e;
} Prevention
- Don't run catalog mutations on threads owned by short-lived or cancellable executors
- Check Thread.interrupted() before long catalog operations
- Ensure shutdown hooks don't interrupt in-flight metadata updates
When it happens
Trigger: Calling setProperties/removeProperties while the calling thread's interrupt flag is set or the interrupt arrives while clients.run(client -> client.getDatabase(...)) is acquiring/waiting for a pooled HMS client.
Common situations: Task cancelled by an executor/pool shutdown; Spark/Flink job cancellation propagating interrupts; query timeouts that interrupt worker threads.
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
- Interrupted during commit
- Cannot rename to . Namespace does not exist
- Failed to create namespace
- Failed to list namespace under namespace
- Interrupted during isHeld
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/c4596c5ebab2c95b.
Report an issue: GitHub.
Appendix: source
Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:686
private void alterHiveDataBase(Namespace namespace, Database database) {
try {
clients.run(
client -> {
client.alterDatabase(namespace.level(0), database);
return null;
});
} catch (NoSuchObjectException | UnknownDBException e) {
throw new NoSuchNamespaceException(e, "Namespace does not exist: %s", namespace);
} catch (TException e) {
throw new RuntimeException(
"Failed to list namespace under namespace: " + namespace + " in Hive Metastore", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(
"Interrupted in call to getDatabase(name) " + namespace + " in Hive Metastore", e);
}
}
@Override
public Map<String, String> loadNamespaceMetadata(Namespace namespace) {
if (!isValidateNamespace(namespace)) {
throw new NoSuchNamespaceException("Namespace does not exist: %s", namespace);
}
try {
Database database = clients.run(client -> client.getDatabase(namespace.level(0)));
Map<String, String> metadata = convertToMetadata(database);
LOG.debug("Loaded metadata for namespace {} found {}", namespace, metadata.keySet());
return metadata;
} catch (NoSuchObjectException | UnknownDBException e) {
throw new NoSuchNamespaceException(e, "Namespace does not exist: %s", namespace);View on GitHub (pinned to 86d9c8fc54)