apache/iceberg · warning · UncheckedInterruptedException
Interrupted in call to initialize
Error message
Interrupted in call to initialize
What it means
If the thread calling JdbcLockFactory.initializeLockTables is interrupted while executing SQL (Tasks retries/pool waiting), the InterruptedException is handled by re-interrupting the thread and throwing UncheckedInterruptedException with this message. It signals the operator/task was cancelled or shutting down during lock initialization.
Solutions
- No code fix needed if caused by intentional job cancellation; the interrupt flag is properly restored.
- If unexpected, check job manager logs for the cancellation/failure that triggered the interrupt.
- Reduce time spent in initializeLockTables (pre-create lock tables) to narrow the interruption window.
- Re-run the job once the cancellation cause is resolved.
Defensive patterns
Strategy: try-catch
Try / catch
try {
lockFactory.open();
} catch (UncheckedInterruptedException e) {
// thread interrupt flag already restored; treat as cancellation
throw e; // or return cleanly if shutdown was expected
} Prevention
- Expect this during job cancellation; don't suppress it
- Pre-create lock tables so open() completes quickly
- Check job logs for the originating cancellation/failure
When it happens
Trigger: JdbcLockFactory.create/open -> initializeLockTables while the enclosing Flink task/operator is cancelled or failed, or the thread is interrupted during the JDBC pool call.
Common situations: Job cancellation/restart during operator open, Flink failover, or shutdown while the DB call is slow (making the interruption window likely).
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Interrupted during isHeld
- Interrupted during tryLock
- Interrupted during tryLock
- Interrupted during unlock
- Cannot initialize JDBC table maintenance lock
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/c58c9bea0fc3b081.
Report an issue: GitHub.
Appendix: source
Thrown at flink/v2.2/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)