apache/hadoop · warning · InvalidRequestException

{this}: invalid slot index {slotIdx}

Error message

{this}: invalid slot index {slotIdx}

What it means

Same datanode-side registerSlot path: the reported slot index is non-negative but at or beyond the segment's slot count (mmappedLength / 64). The client computed the index against a different (larger) segment than the one the datanode has registered, so the request is rejected with InvalidRequestException 'invalid slot index'.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitShm.java:581

   *
   * This function looks at a slot which has already been initialized (by
   * another process), and registers it with us.  Then, it returns the
   * relevant Slot object.
   *
   * @return    The slot.
   *
   * @throws InvalidRequestException
   *            If the slot index we're trying to allocate has not been
   *            initialized, or is already in use.
   */
  synchronized public final Slot registerSlot(int slotIdx,
      ExtendedBlockId blockId) throws InvalidRequestException {
    if (slotIdx < 0) {
      throw new InvalidRequestException(this + ": invalid negative slot " +
          "index " + slotIdx);
    }
    if (slotIdx >= slots.length) {
      throw new InvalidRequestException(this + ": invalid slot " +
          "index " + slotIdx);
    }
    if (allocatedSlots.get(slotIdx)) {
      throw new InvalidRequestException(this + ": slot " + slotIdx +
          " is already in use.");
    }
    Slot slot = new Slot(calculateSlotAddress(slotIdx), blockId);
    if (!slot.isValid()) {
      throw new InvalidRequestException(this + ": slot " + slotIdx +
          " is not marked as valid.");
    }
    slots[slotIdx] = slot;
    allocatedSlots.set(slotIdx, true);
    if (LOG.isTraceEnabled()) {
      LOG.trace(this + ": registerSlot " + slotIdx + ": allocatedSlots=" + allocatedSlots +
                  StringUtils.getStackTrace(Thread.currentThread()));
    }
    return slot;

View on GitHub (pinned to 2add963021)

Solutions

  1. Restart long-lived client processes after datanode restarts or upgrade rolls
  2. Version-match client and datanode on the short-circuit path
  3. Let the client recover: after InvalidRequestException it drops the shm and requests a new one; repeated failures warrant disabling short-circuit reads until state is clean
Defensive patterns

Strategy: try-catch

Try / catch

try {
  // datanode-side registration of client slots
} catch (InvalidRequestException e) {
  // index out of range for this segment: invalidate the client's shm so it requests a new one
}

Prevention

When it happens

Trigger: Client and datanode disagreeing on the shm segment size - the datanode restarted and created a smaller segment while the client kept the old, larger one, or version skew in shm sizing - and the client then requests short-circuit fds for a slot beyond the datanode's array.

Common situations: Datanode restart mid-session with long-lived clients; rolling upgrades mixing versions on the short-circuit path; races where the client maps a segment the datanode already discarded.

Related errors


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