{"record":{"id":"eccf243ee0eeaeb8","repo":"apache/hadoop","slug":"invalid-gridmix-sleep-interval","errorCode":null,"errorMessage":"Invalid gridmix.sleep.interval: {}","messagePattern":"Invalid gridmix\\.sleep\\.interval: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/SleepJob.java","lineNumber":227,"sourceCode":"  public static class SleepInputFormat\n  extends InputFormat<LongWritable, LongWritable> {\n\n    @Override\n    public List<InputSplit> getSplits(JobContext jobCtxt) throws IOException {\n      return pullDescription(jobCtxt);\n    }\n\n    @Override\n    public RecordReader<LongWritable, LongWritable> createRecordReader(\n      InputSplit split, final TaskAttemptContext context)\n      throws IOException, InterruptedException {\n      final long duration = split.getLength();\n      long sleepInterval = \n    \t  context.getConfiguration().getLong(GRIDMIX_SLEEP_INTERVAL, 5);\n      final long RINTERVAL = \n        TimeUnit.MILLISECONDS.convert(sleepInterval, TimeUnit.SECONDS);\n      if (RINTERVAL <= 0) {\n        throw new IOException(\n          \"Invalid \" + GRIDMIX_SLEEP_INTERVAL + \": \" + RINTERVAL);\n      }\n      return new RecordReader<LongWritable, LongWritable>() {\n        long start = -1;\n        long slept = 0L;\n        long sleep = 0L;\n        final LongWritable key = new LongWritable();\n        final LongWritable val = new LongWritable();\n\n        @Override\n        public boolean nextKeyValue() throws IOException {\n          if (start == -1) {\n            start = System.currentTimeMillis();\n          }\n          slept += sleep;\n          sleep = Math.min(duration - slept, RINTERVAL);\n          key.set(slept + sleep + start);\n          val.set(duration - slept);","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/SleepJob.java#L209-L245","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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"],"exampleFix":"# before\nhadoop jar gridmix.jar org.apache.hadoop.mapred.gridmix.Gridmix -Dgridmix.sleep.interval=0 -g trace.json\n\n# after\nhadoop jar gridmix.jar org.apache.hadoop.mapred.gridmix.Gridmix -Dgridmix.sleep.interval=5 -g trace.json","handlingStrategy":"validation","validationCode":"long interval = conf.getLong(\"gridmix.sleep.interval\", 5);\nif (TimeUnit.MILLISECONDS.convert(interval, TimeUnit.SECONDS) <= 0) {\n  throw new IllegalArgumentException(\"gridmix.sleep.interval must be > 0 seconds\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["hadoop","gridmix","sleep-job","configuration","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}