apache/iceberg · info · UncheckedInterruptedException
Interrupted in call to initialize
Error message
Interrupted in call to initialize
What it means
Thrown by JdbcLockFactory.initializeLockTables when the thread is interrupted while waiting for the JDBC connection pool to initialize or execute the lock-table DDL. The library restores the interrupt flag and wraps the InterruptedException in UncheckedInterruptedException. It signals the task/operator is being shut down rather than a database problem.
Source
Thrown at flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/maintenance/api/JdbcLockFactory.java:158
}
LOG.info("Creating Flink maintenance lock table {}", LOCK_TABLE_NAME);
try (PreparedStatement ps = conn.prepareStatement(CREATE_LOCK_TABLE_SQL)) {
ps.execute();
}
return true;
});
} catch (SQLTimeoutException e) {
throw new UncheckedSQLException(
e, "Cannot initialize JDBC table maintenance lock: Query timed out");
} catch (SQLTransientConnectionException | SQLNonTransientConnectionException e) {
throw new UncheckedSQLException(
e, "Cannot initialize JDBC table maintenance lock: Connection failed");
} catch (SQLException e) {
throw new UncheckedSQLException(e, "Cannot initialize JDBC table maintenance lock");
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new UncheckedInterruptedException(e, "Interrupted in call to initialize");
}
}
private static class JdbcLock implements TriggerLockFactory.Lock {
private final JdbcClientPool pool;
private final String lockId;
private final Type type;
private JdbcLock(JdbcClientPool pool, String lockId, Type type) {
this.pool = pool;
this.lockId = lockId;
this.type = type;
}
@Override
public boolean tryLock() {
if (isHeld()) {
LOG.info("Lock is already held for {}", this);View on GitHub (pinned to 86d9c8fc54)
Solutions
- No code fix needed if this happened during intentional job cancellation — it is expected shutdown behavior
- If it occurs repeatedly on startup, check Flink task restart policies and operator open() timeouts
- Verify the database is reachable and fast enough so initialization completes before cancellation
- Inspect logs for the interrupt source (task cancel, failover) rather than the database itself
Defensive patterns
Strategy: try-catch
Try / catch
try {
lockFactory.create();
} catch (UncheckedInterruptedException e) {
Thread.currentThread().interrupt();
// expected during job cancellation; propagate or abort cleanly
} Prevention
- Avoid cancelling jobs during the maintenance operator's open() phase when possible
- Keep DB initialization fast (low-latency network to the lock database)
- Set sensible Flink restart strategies so re-init after interruption is clean
When it happens
Trigger: The Flink taskmanager operator (open) is cancelled or fails while initializeLockTables is blocked acquiring a pooled connection or running CREATE TABLE; job restart/cancel during startup.
Common situations: Job cancellation or savepoint restart while the maintenance operator is initializing; slow database startup causing the operator to be interrupted mid-init; Flink shutdown timeouts.
Related errors
- Interrupted during tryLock
- Interrupted during isHeld
- Interrupted in call to initialize
- Interrupted during tryLock
- Interrupted during isHeld
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/1e12e3c008b1a850.
Report an issue: GitHub.