apache/iceberg · warning · UncheckedInterruptedException

Interrupted in call to initialize

Error message

Interrupted in call to initialize

What it means

initializeLockTables runs statements through Tasks with retry inside JdbcClientPool; if the thread is interrupted while waiting/executing, the InterruptedException is re-flagged on the thread and wrapped in UncheckedInterruptedException with this message.

Source

Thrown at flink/v1.20/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

  1. Treat as cancellation: if intentional, no action needed — the thread interrupt flag is restored.
  2. If unexpected, investigate why initialization was slow (DB latency) to shrink the interrupt window.
  3. Avoid cancelling jobs during startup; allow lock initialization to complete before triggering failover.
  4. Check for hung JDBC connections causing long blocking calls that make interruptions likely.

Example fix

// no code fix; operational guidance:
// ensure DB reachable before starting the job so open() completes quickly and is not interrupted mid-way
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure thread interruption state is clear before opening
if (Thread.currentThread().isInterrupted()) {
    throw new IllegalStateException("Cannot open lock factory with interrupted thread");
}

Try / catch

try {
    lockFactory.open();
} catch (UncheckedInterruptedException e) {
    Thread.currentThread().interrupt(); // preserve cancellation semantics
    // shut down cleanly or rethrow to the cancellation handler
}

Prevention

When it happens

Trigger: JobManager/cancel-thread interruption during JdbcLockFactory.open(); task cancellation, job failover, or shutdown hitting while the lock-table initialization SQL is in flight.

Common situations: Job cancellation or restart while lock initialization is slow/blocked; manual cancel-with-savepoint during startup; JVM shutdown hooks interrupting worker threads.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/eeecef65bf97d93a. Report an issue: GitHub.