apache/hadoop · error · IOException
Invalid gridmix.sleep.interval: {}
Error message
Invalid gridmix.sleep.interval: {} What it means
SleepJob's record reader (createRecordReader) reads gridmix.sleep.interval (seconds, default 5), converts it to milliseconds via TimeUnit.MILLISECONDS.convert(value, TimeUnit.SECONDS), and throws IOException if the result is <= 0. The message reports the converted millisecond value, not the configured value, so 'Invalid gridmix.sleep.interval: 0' means the ms-converted setting was 0 or negative.
Source
Thrown at hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/SleepJob.java:227
public static class SleepInputFormat
extends InputFormat<LongWritable, LongWritable> {
@Override
public List<InputSplit> getSplits(JobContext jobCtxt) throws IOException {
return pullDescription(jobCtxt);
}
@Override
public RecordReader<LongWritable, LongWritable> createRecordReader(
InputSplit split, final TaskAttemptContext context)
throws IOException, InterruptedException {
final long duration = split.getLength();
long sleepInterval =
context.getConfiguration().getLong(GRIDMIX_SLEEP_INTERVAL, 5);
final long RINTERVAL =
TimeUnit.MILLISECONDS.convert(sleepInterval, TimeUnit.SECONDS);
if (RINTERVAL <= 0) {
throw new IOException(
"Invalid " + GRIDMIX_SLEEP_INTERVAL + ": " + RINTERVAL);
}
return new RecordReader<LongWritable, LongWritable>() {
long start = -1;
long slept = 0L;
long sleep = 0L;
final LongWritable key = new LongWritable();
final LongWritable val = new LongWritable();
@Override
public boolean nextKeyValue() throws IOException {
if (start == -1) {
start = System.currentTimeMillis();
}
slept += sleep;
sleep = Math.min(duration - slept, RINTERVAL);
key.set(slept + sleep + start);
val.set(duration - slept);View on GitHub (pinned to 2add963021)
Solutions
- Set a positive value in seconds, e.g. -Dgridmix.sleep.interval=5 (the default)
- To make sleeps as coarse as possible, set the interval >= the longest expected task duration rather than 0
- Check the message's number: it is milliseconds, so divide by 1000 to see what the seconds config resolved to
Example fix
# before hadoop jar gridmix.jar org.apache.hadoop.mapred.gridmix.Gridmix -Dgridmix.sleep.interval=0 -g trace.json # after hadoop jar gridmix.jar org.apache.hadoop.mapred.gridmix.Gridmix -Dgridmix.sleep.interval=5 -g trace.json
Defensive patterns
Strategy: validation
Validate before calling
long interval = conf.getLong("gridmix.sleep.interval", 5);
if (TimeUnit.MILLISECONDS.convert(interval, TimeUnit.SECONDS) <= 0) {
throw new IllegalArgumentException("gridmix.sleep.interval must be > 0 seconds");
} Prevention
- Never set gridmix.sleep.interval to 0 to 'disable' chunking — keep it >= 1 (seconds)
- Assert positive numeric config values in launch scripts before submitting gridmix jobs
When it happens
Trigger: Launching gridmix SleepJob with -Dgridmix.sleep.interval=0 or a negative number; sleep jobs are chopped into interval-sized naps, so a non-positive interval breaks the sleep loop and fails fast in the mapper's record reader.
Common situations: Trying to disable sleep fragmentation by setting the interval to 0; typos or math in scripts computing the interval; copying a config where the property name got the wrong unit assumed (it is in SECONDS).
Related errors
- value cannot be blank
- ${value} is not in expected format.Expected format is <numbe
- Bad configuration of hadoop.security.key.provider.path at ${
- numLevels must be at least 1
- callqueue.capacity.weights must specify ${priorityLevels} ca
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/eccf243ee0eeaeb8.
Report an issue: GitHub.