apache/hadoop · warning · InvalidRequestException

{this}: slot {slotIdx} is already in use.

Error message

{this}: slot {slotIdx} is already in use.

What it means

Datanode-side registerSlot: the requested slot index is in range but its bit in allocatedSlots is already set - the datanode believes the slot is in use from an earlier registration that was never released. Duplicate registration is rejected with InvalidRequestException to avoid aliasing two blocks onto one slot.

Source

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

   *
   * @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;
  }

  /**
   * Unregisters a slot.

View on GitHub (pinned to 2add963021)

Solutions

  1. Usually transient - retry the open; client and datanode converge once the stale registration is released
  2. If it floods the datanode log, restart the client to rebuild shm slot state
  3. Check application logic for duplicate submission around read retries
  4. Version-match client and datanode
Defensive patterns

Strategy: retry

Try / catch

try {
  // open with short-circuit reads
} catch (InvalidRequestException e) {
  // slot already registered: transient retry race - retry once, then reopen with a fresh slot
}

Prevention

When it happens

Trigger: A client re-requesting short-circuit fds for the same block with the same SlotId after a failed first attempt (retry duplication), two clients or threads referencing the same slot index, or a slot release that never reached the datanode.

Common situations: Read retries racing slot release; domain-socket hiccups causing duplicate requests; client reconnects after transient errors.

Related errors


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