apache/iceberg · warning · UncheckedInterruptedException

Interrupted while listing databases

Error message

Interrupted while listing databases

What it means

JdbcSnowflakeClient.listDatabases wraps InterruptedException from the 'SHOW DATABASES IN ACCOUNT' query into UncheckedInterruptedException. Listing failed because the thread was interrupted mid-query, usually by cancellation or shutdown rather than a data problem. SQLExceptions from the same query instead map to a generic IcebergException via snowflakeExceptionToIcebergException.

Solutions

  1. Restore the interrupt flag (Thread.currentThread().interrupt()) when catching and abort
  2. Investigate the cancellation source (job kill, shutdown hook, query timeout) and raise limits if premature
  3. Retry listing once the environment is stable
  4. Avoid issuing account-wide listing calls from threads subject to frequent interruption
Defensive patterns

Strategy: try-catch

Validate before calling

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

Try / catch

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

Prevention

When it happens

Trigger: Thread interrupted while running 'SHOW DATABASES IN ACCOUNT' through the JDBC query harness — e.g. engine task cancellation, executor shutdown, or timeout-triggered interrupts.

Common situations: Spark job cancelled while browsing namespaces in a UI/CLI, service shutdown during catalog warm-up, or health-check probes timing out and cancelling 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


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

Appendix: source

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

    }

    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");
    } catch (InterruptedException e) {
      throw new UncheckedInterruptedException(e, "Interrupted while listing databases");
    }
    databases.forEach(
        db ->
            Preconditions.checkState(
                db.type() == SnowflakeIdentifier.Type.DATABASE,
                "Expected DATABASE, got identifier '%s'",
                db));
    return databases;
  }

  @Override
  public List<SnowflakeIdentifier> listSchemas(SnowflakeIdentifier scope) {
    StringBuilder baseQuery = new StringBuilder("SHOW SCHEMAS");
    String[] queryParams = null;
    switch (scope.type()) {
      case ROOT:
        // account-level listing
        baseQuery.append(" IN ACCOUNT");

View on GitHub (pinned to 86d9c8fc54)