{"record":{"id":"4d2365686ed1b96b","repo":"apache/iceberg","slug":"interrupted-while-waiting-for-array-pool-entry-4d2365","errorCode":null,"errorMessage":"Interrupted while waiting for array pool entry","messagePattern":"Interrupted while waiting for array pool entry","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/source/reader/ArrayPoolDataIteratorBatcher.java","lineNumber":157,"sourceCode":"    }\n\n    @Override\n    public void wakeUp() {\n      pool.wakeUp();\n    }\n\n    /**\n     * Gets a cached entry from the pool, blocking until an entry is recycled or the reader is woken\n     * up.\n     *\n     * @return a cached array from the pool, or {@code null} if woken up\n     */\n    private T[] getCachedEntry() {\n      try {\n        return pool.pollEntry();\n      } catch (InterruptedException e) {\n        Thread.currentThread().interrupt();\n        throw new RuntimeException(\"Interrupted while waiting for array pool entry\", e);\n      }\n    }\n  }\n}\n","sourceCodeStart":139,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/source/reader/ArrayPoolDataIteratorBatcher.java#L139-L162","documentation":"ArrayPoolDataIteratorBatcher.getCachedEntry polls an object/array pool that blocks until an entry is available; if the waiting thread is interrupted, it re-establishes the interrupt flag and wraps the InterruptedException in a RuntimeException. This normally happens only when the source task is being cancelled or is shutting down.","triggerScenarios":"The record reader thread calls batch() -> getCachedEntry() and pool.pollEntry() is interrupted while blocked waiting for a pooled array (task cancellation, checkpoint/stop-with-savepoint, job failover).","commonSituations":"Job cancellation racing with record reading; reader thread starvation where the pool never recycles arrays because downstream stalled; misconfigured pool sizing under high parallelism.","solutions":["Usually expected during cancellation — verify the job was intentionally cancelled/restarted; if not, look at what interrupted the reader thread.","Check for downstream backpressure causing records/batches to never be returned to the pool; inspect backpressure metrics.","Tune batch/array pool sizing or the reader's fetch batch size so entries are recycled faster.","If the job repeatedly dies with this during failover, ensure cancellation is given time to finish and the source honors the interrupt cleanly."],"exampleFix":"// before: huge batches starve the pool\nIcebergSource.builder().fetchBatchSize(100_000)...\n// after\nIcebergSource.builder().fetchBatchSize(1_024)... // smaller batches recycle pool entries","handlingStrategy":"retry","validationCode":"// check backpressure/pool health before assuming a bug\nif (taskMetrics.getBackPressuredTimeMs().getValue() > threshold) {\n  // reduce fetch batch size or scale parallelism\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep fetch batch sizes moderate so pool entries recycle quickly.","Watch Flink backpressure metrics; scale parallelism before threads stall.","Expect and tolerate this exception during normal job cancellation."],"tags":["flink","reader","interruption","threading"],"backgroundTag":"request-timeout","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}