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
- Restart long-lived client processes after datanode restarts or upgrade rolls
- Version-match client and datanode on the short-circuit path
- 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
- Restart long-lived clients after datanode restarts or rolling upgrades
- Monitor datanode logs for shm mismatches during upgrade rolls as an early skew signal
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
- {this}: slot {slotIdx} does not exist.
- {this}: invalid negative slot index {slotIdx}
- {this}: slot {slotIdx} is already in use.
- {this}: no more slots are available.
- {this}: slot {slotIdx} is not marked as valid.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/9b692aba10af0ac9.
Report an issue: GitHub.