apache/iceberg · error · UncheckedInterruptedException

Interrupted during refresh

Error message

Interrupted during refresh

What it means

Thrown by JdbcViewOperations.doRefresh when the thread is interrupted while loading the view record from the JDBC catalog via JdbcUtil.loadView. The interrupt flag is restored before throwing. It means the view refresh (which underpins every read of view metadata) was cancelled, not that the view is missing.

Source

Thrown at core/src/main/java/org/apache/iceberg/jdbc/JdbcViewOperations.java:74

      String catalogName,
      TableIdentifier viewIdentifier,
      Map<String, String> catalogProperties) {
    this.catalogName = catalogName;
    this.viewIdentifier = viewIdentifier;
    this.fileIO = fileIO;
    this.connections = dbConnPool;
    this.catalogProperties = catalogProperties;
  }

  @Override
  protected void doRefresh() {
    Map<String, String> view;

    try {
      view = JdbcUtil.loadView(JdbcUtil.SchemaVersion.V1, connections, catalogName, viewIdentifier);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new UncheckedInterruptedException(e, "Interrupted during refresh");
    } catch (SQLException e) {
      // SQL exception happened when getting view from catalog
      throw new UncheckedSQLException(
          e, "Failed to get view %s from catalog %s", viewIdentifier, catalogName);
    }

    if (view.isEmpty()) {
      if (currentMetadataLocation() != null) {
        throw new NoSuchViewException("View does not exist: %s", viewIdentifier);
      } else {
        this.disableRefresh();
        return;
      }
    }

    String newMetadataLocation = view.get(JdbcTableOperations.METADATA_LOCATION_PROP);
    Preconditions.checkState(
        newMetadataLocation != null, "Invalid view %s: metadata location is null", viewIdentifier);

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Retry the loadView operation on a non-interrupted thread
  2. Investigate why the thread was interrupted (job cancellation, timeout, shutdown hook)
  3. Reduce query latency (indexes on the catalog tables, connection pool sizing) so refreshes complete before cancellation
  4. Catch UncheckedInterruptedException in the caller and handle cancellation cleanly

Example fix

// before
View view = catalog.loadView(ident);
// after
try {
  View view = catalog.loadView(ident);
} catch (UncheckedInterruptedException e) {
  Thread.currentThread().interrupt(); // already re-interrupted; handle cancellation
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (Thread.currentThread().isInterrupted()) {
  throw new IllegalStateException("Interrupted before view refresh");
}

Try / catch

try {
  View view = catalog.loadView(ident);
} catch (UncheckedInterruptedException e) {
  Thread.currentThread().interrupt();
  throw e; // propagate cancellation to the framework
}

Prevention

When it happens

Trigger: Any view read/commit path that triggers doRefresh (e.g. catalog.loadView, view scans, commits) while the thread is interrupted during connection-pool acquisition or SQL execution.

Common situations: Spark/Flink task cancellation, application shutdown, or scheduled jobs cancelled while refreshing view metadata from a slow or overloaded database.

Related errors


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