apache/iceberg · warning · UncheckedInterruptedException

Interrupted while checking if schema

Error message

Interrupted while checking if schema '%s' exists

What it means

JdbcSnowflakeClient.schemaExists wraps InterruptedException raised while the schema existence JDBC query runs into UncheckedInterruptedException. It signals the calling thread was interrupted mid-check, typically by task cancellation or shutdown. Propagating it unchecked lets the surrounding engine honor cancellation.

Solutions

  1. Catch UncheckedInterruptedException, restore the interrupt flag with Thread.interrupt(), and unwind
  2. Identify and tune the source of cancellation (speculative execution, timeouts, shutdown sequencing)
  3. Retry the existence check once the executor is stable
  4. Keep catalog operations off threads you plan to shut down abruptly
Defensive patterns

Strategy: try-catch

Validate before calling

if (Thread.currentThread().isInterrupted()) {
  throw new InterruptedException("Interrupted before schemaExists call");
}

Try / catch

try {
  client.schemaExists(schemaId);
} catch (UncheckedInterruptedException e) {
  Thread.currentThread().interrupt();
  throw e;
}

Prevention

When it happens

Trigger: Thread interruption during the schemaExists JDBC query — from Spark/Flink task cancellation, executor shutdownNow, or a scheduling timeout cancelling catalog operations.

Common situations: Speculative execution cancelling duplicate Spark tasks, pod shutdown in Kubernetes mid-query, or a custom thread pool shutting down while catalog calls run.

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


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

Appendix: source

Thrown at snowflake/src/main/java/org/apache/iceberg/snowflake/JdbcSnowflakeClient.java:205

    if (!databaseExists(SnowflakeIdentifier.ofDatabase(schema.databaseName()))) {
      return false;
    }

    final String finalQuery = "SHOW TABLES IN SCHEMA IDENTIFIER(?) LIMIT 1";

    try {
      connectionPool.run(
          conn ->
              queryHarness.query(
                  conn, finalQuery, TABLE_RESULT_SET_HANDLER, schema.toIdentifierString()));
    } catch (SQLException e) {
      if (SCHEMA_NOT_FOUND_ERROR_CODES.contains(e.getErrorCode())) {
        return false;
      }
      throw new UncheckedSQLException(e, "Failed to check if schema '%s' exists", schema);
    } catch (InterruptedException e) {
      throw new UncheckedInterruptedException(
          e, "Interrupted while checking if schema '%s' exists", schema);
    }

    return true;
  }

  @Override
  public List<SnowflakeIdentifier> listDatabases() {
    List<SnowflakeIdentifier> databases;
    try {
      databases =
          connectionPool.run(
              conn ->
                  queryHarness.query(
                      conn, "SHOW DATABASES IN ACCOUNT", DATABASE_RESULT_SET_HANDLER));
    } catch (SQLException e) {
      throw snowflakeExceptionToIcebergException(
          SnowflakeIdentifier.ofRoot(), e, "Failed to list databases");

View on GitHub (pinned to 86d9c8fc54)