{"record":{"id":"17969c3db0414efb","repo":"apache/hadoop","slug":"read-request-interrupted","errorCode":null,"errorMessage":"Read request interrupted","messagePattern":"Read request interrupted","errorType":"exception","errorClass":"InterruptedIOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/StripeReader.java","lineNumber":403,"sourceCode":"        } else {\n          returnedChunk.state = StripingChunk.MISSING;\n          // close the corresponding reader\n          dfsStripedInputStream.closeReader(readerInfos[r.index]);\n\n          final int missing = alignedStripe.missingChunksNum;\n          alignedStripe.missingChunksNum++;\n          checkMissingBlocks();\n\n          readDataForDecoding();\n          readParityChunks(alignedStripe.missingChunksNum - missing);\n        }\n      } catch (InterruptedException ie) {\n        String err = \"Read request interrupted\";\n        DFSClient.LOG.error(err, ie);\n        dfsStripedInputStream.closeCurrentBlockReaders();\n        clearFutures();\n        // Don't decode if read interrupted\n        throw new InterruptedIOException(err);\n      }\n    }\n\n    if (alignedStripe.missingChunksNum > 0) {\n      decode();\n    }\n  }\n\n  /**\n   * Some fetched {@link StripingChunk} might be stored in original application\n   * buffer instead of prepared decode input buffers. Some others are beyond\n   * the range of the internal blocks and should correspond to all zero bytes.\n   * When all pending requests have returned, this method should be called to\n   * finalize decode input buffers.\n   */\n\n  void finalizeDecodeInputs() {\n    for (int i = 0; i < alignedStripe.chunks.length; i++) {","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/StripeReader.java#L385-L421","documentation":"StripeReader throws InterruptedIOException(\"Read request interrupted\") when the thread performing an erasure-coded read is interrupted while waiting for striped chunk read futures. The client closes all current block readers and cancels pending futures, deliberately skipping decode because a partially read stripe would produce corrupt data.","triggerScenarios":"Thread interrupt during an EC file read: Future.cancel(true), ExecutorService.shutdownNow(), framework task cancellation/timeouts (MapReduce/Spark killing the reader thread), or JVM shutdown hooks interrupting in-flight reads.","commonSituations":"Job or task cancellation while reading EC files; query timeouts that interrupt worker threads; test harnesses that interrupt reader threads; shutdownNow() on pools that own HDFS reads.","solutions":["If the interrupt is intentional cancellation, treat InterruptedIOException as a clean stop and unwind without retrying","Stop using Future.cancel(true) or shutdownNow() on threads that own HDFS reads; use cooperative cancellation flags","Restore the interrupt flag when catching so upper layers still observe the cancellation","If interrupts are unexpected, audit which component calls Thread.interrupt() on the reader thread"],"exampleFix":"// before: interrupt leaks and the read state is unclear\nFuture<byte[]> f = pool.submit(readTask);\nf.cancel(true);\n\n// after: cooperative cancellation, and clean interrupt handling in the reader\ntry {\n  return readTask.call();\n} catch (InterruptedIOException e) {\n  Thread.currentThread().interrupt();\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  in.read(buf, off, len);\n} catch (InterruptedIOException e) {\n  Thread.currentThread().interrupt(); // preserve cancellation\n  // expected on shutdown/cancel: stop reading, do not retry","preventionTips":["Never cancel reader threads with Future.cancel(true) or shutdownNow(); signal cooperation via flags","Restore the interrupt flag in every catch of InterruptedIOException/InterruptedException","Treat this exception as an expected outcome during job cancellation, not a defect to fix"],"tags":["hdfs","erasure-coding","interruption","concurrency"],"backgroundTag":"thread-interrupted","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}