{"record":{"id":"8b9f2d6e4fd28696","repo":"apache/hadoop","slug":"sleepmillis-sleepmillis-0","errorCode":null,"errorMessage":"sleepMillis = ${sleepMillis} < 0","messagePattern":"sleepMillis = (.+?) < 0","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryPolicies.java","lineNumber":398,"sourceCode":"   * the following n1 retries sleep t1 milliseconds on average, and so on.\n   * \n   * For all the sleep, the actual sleep time is randomly uniform distributed\n   * in the close interval [0.5t, 1.5t], where t is the sleep time specified.\n   *\n   * The objects of this class are immutable.\n   */\n  public static class MultipleLinearRandomRetry implements RetryPolicy {\n    /** Pairs of numRetries and sleepSeconds */\n    public static class Pair {\n      final int numRetries;\n      final int sleepMillis;\n      \n      public Pair(final int numRetries, final int sleepMillis) {\n        if (numRetries < 0) {\n          throw new IllegalArgumentException(\"numRetries = \" + numRetries+\" < 0\");\n        }\n        if (sleepMillis < 0) {\n          throw new IllegalArgumentException(\"sleepMillis = \" + sleepMillis + \" < 0\");\n        }\n\n        this.numRetries = numRetries;\n        this.sleepMillis = sleepMillis;\n      }\n      \n      @Override\n      public String toString() {\n        return numRetries + \"x\" + sleepMillis + \"ms\";\n      }\n    }\n\n    private final List<Pair> pairs;\n    private String myString;\n\n    public MultipleLinearRandomRetry(List<Pair> pairs) {\n      if (pairs == null || pairs.isEmpty()) {\n        throw new IllegalArgumentException(\"pairs must be neither null nor empty.\");","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/retry/RetryPolicies.java#L380-L416","documentation":"The second constructor guard on MultipleLinearRandomRetry.Pair: sleepMillis, the delay for that rung of the piecewise retry schedule, must be non-negative. A negative delay cannot be scheduled; like the count guard, it exists to turn a bad parsed spec into an immediate, descriptive failure.","triggerScenarios":"Parsed specs with a negative delay token, or misaligned token pairs where a count lands in the sleep slot; computed backoff offsets underflowing below zero.","commonSituations":"Retry spec strings edited by hand with negative values; token pairs shifted after inserting/removing a number; sleeps computed as base*factor - offset going negative.","solutions":["Re-validate the spec string and print the parsed pairs before construction to spot misalignment.","Fix the negative delay value in the configuration.","Clamp computed sleeps with Math.max(0, value) at the source."],"exampleFix":"// before\nnew MultipleLinearRandomRetry.Pair(3, -1000);\n\n// after\nlong sleep = Math.max(0L, parseSleep(token));\nnew MultipleLinearRandomRetry.Pair(3, sleep);","handlingStrategy":"validation","validationCode":"Preconditions.checkArgument(sleepMillis >= 0,\n    \"retry sleep must be >= 0, got %s (spec token: %s)\", sleepMillis, rawToken);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Log the parsed (count, sleep) pairs before constructing the policy to catch token misalignment.","Clamp computed delays with Math.max(0, value).","Validate spec strings in config linting, not at first RPC."],"tags":["retry-policy","configuration","illegal-argument","hadoop-common"],"backgroundTag":"invalid-config-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}