{"record":{"id":"9822a8be4f9fe732","repo":"apache/iceberg","slug":"interrupted-while-waiting-for-array-pool-entry","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":"error","filePath":"flink/v1.20/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/v1.20/flink/src/main/java/org/apache/iceberg/flink/source/reader/ArrayPoolDataIteratorBatcher.java#L139-L162","documentation":"ArrayPoolDataIteratorBatcher's getCachedEntry waits on a pool entry (thread-interruptible); if the thread is interrupted while blocked in pool.pollEntry(), it re-interrupts the thread and throws RuntimeException. This happens when the record reader's batch fetch task is cancelled or interrupted.","triggerScenarios":"The thread batching fetched records into arrays is interrupted while waiting for a pooled array — typically during job cancellation, failover, or task shutdown.","commonSituations":"Job cancellation while reading; Flink task failover mid-read; shutdown of the source reader.","solutions":["Usually benign during job cancel/failover — verify the cancellation was intentional and restart/resume the job.","If it happens unexpectedly, check for external code calling Thread.interrupt() on task threads (custom thread pools, watchdogs).","Check upstream fetch tasks for stuck behavior that delays pool entry return and triggers slow cancellation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  T[] batch = batcher.batch(records);\n} catch (RuntimeException e) {\n  if (Thread.currentThread().isInterrupted() || e.getMessage().contains(\"Interrupted\")) {\n    // expected during cancel/failover — exit quietly\n    return;\n  }\n  throw e;\n}","preventionTips":["Expect this exception during job cancellation and failover; configure a sensible restart strategy","Avoid custom code that interrupts Flink task threads","Monitor fetch tasks so pool entries are returned promptly"],"tags":["flink","interruption","threading","source-reader"],"backgroundTag":"task-cancelled","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"}