apache/iceberg · error · RuntimeException

Interrupted while waiting for array pool entry

Error message

Interrupted while waiting for array pool entry

What it means

getCachedEntry polls an element from a blocking RecycledArrayPool of reusable T[] buffers. If the polling thread is interrupted while waiting for a free array to become available, the interrupt flag is restored and this RuntimeException is thrown with InterruptedException as the cause. It protects the pool's blocking contract while propagating the task cancellation.

Source

Thrown at flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/source/reader/ArrayPoolDataIteratorBatcher.java:157

    }

    @Override
    public void wakeUp() {
      pool.wakeUp();
    }

    /**
     * Gets a cached entry from the pool, blocking until an entry is recycled or the reader is woken
     * up.
     *
     * @return a cached array from the pool, or {@code null} if woken up
     */
    private T[] getCachedEntry() {
      try {
        return pool.pollEntry();
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new RuntimeException("Interrupted while waiting for array pool entry", e);
      }
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Check the InterruptedException cause for who interrupted the reader; if it was job cancellation, no code change is needed - let the task stop.
  2. Increase the array pool size (e.g. via IcebergSourceOptions.ARRAY_POOL_SIZE / fetch-related options) so readers rarely block waiting for buffers.
  3. Verify downstream operators release records promptly; slow consumers keep arrays checked out and starve the pool.
  4. Ensure the interrupt flag is respected downstream; do not swallow the RuntimeException in custom reader code.
Defensive patterns

Strategy: try-catch

Try / catch

try { T[] arr = batch(...); } catch (RuntimeException e) { if (e.getCause() instanceof InterruptedException) { /* reader shutting down: restore interrupt and exit loop */ Thread.currentThread().interrupt(); return; } throw e; }

Prevention

When it happens

Trigger: The Flink source reader thread calls batch() -> getCachedEntry() while the pool is exhausted and all arrays are still checked out, and the thread is interrupted (e.g. task cancellation, checkpoint/reader shutdown) while blocked in pool.pollEntry().

Common situations: Flink job cancellation or failover while a reader is waiting for buffers; downstream operators too slow to return arrays, keeping the pool exhausted; misconfigured pool sizing causing long blocking waits that overlap with shutdown.

Related errors


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