apache/hadoop · error · InterruptedIOException

Read request interrupted

Error message

Read request interrupted

What it means

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.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/StripeReader.java:403

        } else {
          returnedChunk.state = StripingChunk.MISSING;
          // close the corresponding reader
          dfsStripedInputStream.closeReader(readerInfos[r.index]);

          final int missing = alignedStripe.missingChunksNum;
          alignedStripe.missingChunksNum++;
          checkMissingBlocks();

          readDataForDecoding();
          readParityChunks(alignedStripe.missingChunksNum - missing);
        }
      } catch (InterruptedException ie) {
        String err = "Read request interrupted";
        DFSClient.LOG.error(err, ie);
        dfsStripedInputStream.closeCurrentBlockReaders();
        clearFutures();
        // Don't decode if read interrupted
        throw new InterruptedIOException(err);
      }
    }

    if (alignedStripe.missingChunksNum > 0) {
      decode();
    }
  }

  /**
   * Some fetched {@link StripingChunk} might be stored in original application
   * buffer instead of prepared decode input buffers. Some others are beyond
   * the range of the internal blocks and should correspond to all zero bytes.
   * When all pending requests have returned, this method should be called to
   * finalize decode input buffers.
   */

  void finalizeDecodeInputs() {
    for (int i = 0; i < alignedStripe.chunks.length; i++) {

View on GitHub (pinned to 2add963021)

Solutions

  1. If the interrupt is intentional cancellation, treat InterruptedIOException as a clean stop and unwind without retrying
  2. Stop using Future.cancel(true) or shutdownNow() on threads that own HDFS reads; use cooperative cancellation flags
  3. Restore the interrupt flag when catching so upper layers still observe the cancellation
  4. If interrupts are unexpected, audit which component calls Thread.interrupt() on the reader thread

Example fix

// before: interrupt leaks and the read state is unclear
Future<byte[]> f = pool.submit(readTask);
f.cancel(true);

// after: cooperative cancellation, and clean interrupt handling in the reader
try {
  return readTask.call();
} catch (InterruptedIOException e) {
  Thread.currentThread().interrupt();
  throw e;
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  in.read(buf, off, len);
} catch (InterruptedIOException e) {
  Thread.currentThread().interrupt(); // preserve cancellation
  // expected on shutdown/cancel: stop reading, do not retry

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/17969c3db0414efb. Report an issue: GitHub.