apache/iceberg · error · UncheckedInterruptedException
Interrupted in SQL query
Error message
Interrupted in SQL query
What it means
fetch() catches InterruptedException while running catalog queries and throws UncheckedInterruptedException with "Interrupted in SQL query" after restoring the thread's interrupt flag. The thread was signalled to stop while a catalog read (list/entries) was executing.
Source
Thrown at core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java:816
try (PreparedStatement preparedStatement = conn.prepareStatement(sql)) {
for (int pos = 0; pos < args.length; pos += 1) {
preparedStatement.setString(pos + 1, args[pos]);
}
try (ResultSet rs = preparedStatement.executeQuery()) {
while (rs.next()) {
result.add(toRow.apply(rs));
}
}
}
return result;
});
} catch (SQLException e) {
throw new UncheckedSQLException(e, "Failed to execute query: %s", sql);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new UncheckedInterruptedException(e, "Interrupted in SQL query");
}
}
private Map<String, String> fetchProperties(Namespace namespace) {
if (!namespaceExists(namespace)) {
throw new NoSuchNamespaceException("Namespace does not exist: %s", namespace);
}
String namespaceName = JdbcUtil.namespaceToString(namespace);
List<Map.Entry<String, String>> entries =
fetch(
row ->
new AbstractMap.SimpleImmutableEntry<>(
row.getString(JdbcUtil.NAMESPACE_PROPERTY_KEY),
row.getString(JdbcUtil.NAMESPACE_PROPERTY_VALUE)),
JdbcUtil.GET_ALL_NAMESPACE_PROPERTIES_SQL,
catalogName,View on GitHub (pinned to 86d9c8fc54)
Solutions
- Do not interrupt threads performing catalog reads; cancel at a higher level
- Restore and honor the interrupt flag (the catalog already sets it) and stop processing
- Increase timeouts so watchdogs do not interrupt slow queries
- Retry the read from a fresh, non-interrupted thread if the operation is safe to repeat
Example fix
// before
List<Namespace> ns = catalog.listNamespaces();
// after
try {
List<Namespace> ns = catalog.listNamespaces();
} catch (UncheckedInterruptedException e) {
Thread.currentThread().interrupt();
throw e;
} Defensive patterns
Strategy: try-catch
Try / catch
try {
List<Namespace> namespaces = catalog.listNamespaces();
} catch (UncheckedInterruptedException e) {
Thread.currentThread().interrupt();
throw e; // stop processing; thread was asked to cancel
} Prevention
- Honor the interrupt flag — the catalog restores it; do not swallow it
- Avoid interrupt-based timeouts around catalog reads
- Cancel background scans cooperatively instead of via Thread.interrupt
- Keep queries fast with proper indexes on catalog tables
When it happens
Trigger: Thread interrupt during listTables/listNamespaces/listViews/entries: executor shutdown, task cancellation, or timeout watchdogs interrupting a blocked JDBC read.
Common situations: Graceful shutdown racing background catalog scans; Spark task preemption; interruptible connection-statement timeouts firing mid-query.
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 in call to initialize
- Interrupted in SQL command
- Interrupted during commit
- Interrupted during tryLock
- Failed to execute query: %s
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/7120878c80dd5caf.
Report an issue: GitHub.