apache/iceberg · error · UncheckedInterruptedException
Interrupted in SQL command
Error message
Interrupted in SQL command
What it means
execute() runs SQL through Tasks, which can be interrupted while waiting/retrying; on InterruptedException the catalog wraps it in UncheckedInterruptedException with "Interrupted in SQL command". The calling thread's interrupt flag was set while the catalog metadata write was in flight.
Source
Thrown at core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java:782
}
private int execute(Consumer<SQLException> sqlErrorHandler, String sql, String... args) {
try {
return connections.run(
conn -> {
try (PreparedStatement preparedStatement = conn.prepareStatement(sql)) {
for (int pos = 0; pos < args.length; pos += 1) {
preparedStatement.setString(pos + 1, args[pos]);
}
return preparedStatement.executeUpdate();
}
});
} catch (SQLException e) {
sqlErrorHandler.accept(e);
throw new UncheckedSQLException(e, "Failed to execute: %s", sql);
} catch (InterruptedException e) {
throw new UncheckedInterruptedException(e, "Interrupted in SQL command");
}
}
@FunctionalInterface
interface RowProducer<R> {
R apply(ResultSet result) throws SQLException;
}
@SuppressWarnings("checkstyle:NestedTryDepth")
private <R> List<R> fetch(RowProducer<R> toRow, String sql, String... args) {
try {
return connections.run(
conn -> {
List<R> result = Lists.newArrayList();
try (PreparedStatement preparedStatement = conn.prepareStatement(sql)) {
for (int pos = 0; pos < args.length; pos += 1) {
preparedStatement.setString(pos + 1, args[pos]);View on GitHub (pinned to 86d9c8fc54)
Solutions
- Avoid interrupting threads performing catalog commits; drain tasks before shutdown
- Increase timeouts so watchdogs do not interrupt long SQL operations
- Check whether the write completed despite interruption (verify catalog state) before retrying
- Catch UncheckedInterruptedException, restore the interrupt flag, and unwind cleanly
Example fix
// before
catalog.createTable(ident, schema);
// after
try {
catalog.createTable(ident, schema);
} catch (UncheckedInterruptedException e) {
Thread.currentThread().interrupt();
throw e;
} Defensive patterns
Strategy: try-catch
Try / catch
try {
catalog.dropTable(ident);
} catch (UncheckedInterruptedException e) {
Thread.currentThread().interrupt();
// verify whether the write completed before retrying
throw e;
} Prevention
- Do not interrupt threads that are committing catalog changes
- Use graceful shutdown that awaits in-flight commits
- Set generous timeouts so watchdogs never interrupt SQL writes
- After interruption, verify catalog state before re-issuing the operation
When it happens
Trigger: Thread interrupt during a JdbcCatalog metadata write (e.g., task cancellation, executor shutdown, query timeout wrapper, Ctrl-C driven shutdown while committing catalog changes).
Common situations: Application shutdown cancelling in-flight commits; Spark/Flink task cancellation; custom timeouts that interrupt worker threads; blocking JDBC driver calls interrupted by watchdog 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 in call to initialize
- Interrupted in SQL query
- Interrupted during commit
- Interrupted during tryLock
- Failed to insert: %d of %d succeeded
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/8d019b42821435ee.
Report an issue: GitHub.