apache/iceberg · warning · RuntimeException

Interrupted during refresh

Error message

Interrupted during refresh

What it means

HiveTableOperations.doRefresh catches InterruptedException, restores the thread's interrupt flag, and rethrows as RuntimeException 'Interrupted during refresh'. The refresh was cancelled while waiting on the metastore call, typically during shutdown or task cancellation.

Solutions

  1. Treat it as cancellation: let the job terminate; restart if the operation must complete.
  2. Avoid interrupting threads during catalog operations, or retry the full operation after re-establishing context.
  3. The interrupt flag is restored, so keep propagation intact — do not swallow it in surrounding code.

Example fix

// before
try { table.refresh(); } catch (RuntimeException e) { /* ignore */ } // swallows interruption
// after
try { table.refresh(); } catch (RuntimeException e) { if (Thread.currentThread().isInterrupted()) throw e; }
Defensive patterns

Strategy: try-catch

Try / catch

try { table.refresh(); } catch (RuntimeException e) { if (Thread.currentThread().isInterrupted()) { /* cancellation path: stop work */ return; } throw e; }

Prevention

When it happens

Trigger: Thread interrupted while inside the HMS client call in doRefresh — e.g. executor shutdown, Spark task kill, or query cancellation during table refresh.

Common situations: Cancelling a Spark/Flink job; application shutdown while a catalog refresh is in flight; timeouts that interrupt worker 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/c323116642bf67c3. Report an issue: GitHub.

Appendix: source

Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:203

      (e.g. metadata json file) that can be tampered with. For example, an attacker can remove
      the table key parameter (along with existing snapshots) in the file, making the writers
      produce unencrypted files. Table key ID is taken directly from HMS catalog */
      tableKeyIdFromHMS = table.getParameters().get(TableProperties.ENCRYPTION_TABLE_KEY);
      dekLengthFromHMS = table.getParameters().get(TableProperties.ENCRYPTION_DEK_LENGTH);
      metadataHashFromHMS = table.getParameters().get(METADATA_HASH_PROP);
    } catch (NoSuchObjectException e) {
      if (currentMetadataLocation() != null) {
        throw new NoSuchTableException("No such table: %s.%s", database, tableName);
      }

    } catch (TException e) {
      String errMsg =
          String.format("Failed to get table info from metastore %s.%s", database, tableName);
      throw new RuntimeException(errMsg, e);

    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new RuntimeException("Interrupted during refresh", e);
    }

    refreshFromMetadataLocation(metadataLocation, metadataRefreshMaxRetries);

    if (tableKeyIdFromHMS != null) {
      checkIntegrityForEncryption(tableKeyIdFromHMS, dekLengthFromHMS, metadataHashFromHMS);

      tableKeyId = tableKeyIdFromHMS;
      encryptionDekLength =
          (dekLengthFromHMS != null)
              ? Integer.parseInt(dekLengthFromHMS)
              : TableProperties.ENCRYPTION_DEK_LENGTH_DEFAULT;

      encryptedKeys =
          Optional.ofNullable(current().encryptionKeys())
              .map(Lists::newLinkedList)
              .orElseGet(Lists::newLinkedList);

View on GitHub (pinned to 86d9c8fc54)