{"record":{"id":"87da842a41721716","repo":"apache/hadoop","slug":"min-sleep-time-must-be-positive-number-and-max-sle","errorCode":null,"errorMessage":"min sleep time must be positive number and max sleep time must be greater than min sleep time !","messagePattern":"min sleep time must be positive number and max sleep time must be greater than min sleep time !","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-cloud-storage-project/hadoop-bos/src/main/java/org/apache/hadoop/fs/bos/BosRandomRetryPolicy.java","lineNumber":58,"sourceCode":"  private TimeUnit timeUnit;\n  private int minSleep;\n  private int maxSleep;\n\n  /**\n   * Constructs a BosRandomRetryPolicy.\n   *\n   * @param maxRetries the maximum number of retries\n   * @param minSleep   the minimum sleep time\n   * @param maxSleep   the maximum sleep time\n   * @param timeUnit   the time unit for sleep values\n   * @throws IllegalArgumentException if minSleep is negative\n   *         or maxSleep is not greater than minSleep\n   */\n  public BosRandomRetryPolicy(\n      int maxRetries, int minSleep,\n      int maxSleep, TimeUnit timeUnit) {\n    if (minSleep < 0 || maxSleep <= minSleep) {\n      throw new IllegalArgumentException(\n          \"min sleep time must be positive number and\"\n              + \" max sleep time must be greater than\"\n              + \" min sleep time !\");\n    }\n    this.maxRetries = maxRetries;\n    this.minSleep = minSleep;\n    this.maxSleep = maxSleep;\n    this.timeUnit = timeUnit;\n  }\n\n  /**\n   * Determines whether the operation should be retried.\n   *\n   * @param e the exception that triggered the retry\n   * @param retries the number of retries so far\n   * @param failovers the number of failovers so far\n   * @param isIdempotentOrAtMostOnce whether the operation is\n   *        idempotent or at-most-once","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-cloud-storage-project/hadoop-bos/src/main/java/org/apache/hadoop/fs/bos/BosRandomRetryPolicy.java#L40-L76","documentation":"BosRandomRetryPolicy's constructor validates its sleep window and throws IllegalArgumentException unless minSleep >= 0 and maxSleep > minSleep (strict). The comparison uses the raw ints before any TimeUnit conversion, so only the numeric relation matters. It fails fast at policy construction, which normally means at client/FileSystem initialization from fs.bos retry configuration.","triggerScenarios":"Constructing BosRandomRetryPolicy(maxRetries, minSleep, maxSleep, unit) with a negative minSleep or maxSleep <= minSleep — typically fs.bos config keys where the min sleep is set greater than or equal to the max.","commonSituations":"Copying config snippets between versions whose property semantics changed; hand-edited site XML where min and max are transposed or both set to the same value (not allowed — strict inequality); unit confusion producing equal effective values.","solutions":["Set maxSleep strictly greater than minSleep, e.g. min 100 / max 800 (any unit)","Check the site XML for transposed or equal min/max retry-sleep properties and correct them","Add a deployment smoke test that constructs the policy (or initializes the FileSystem) before rolling config out"],"exampleFix":"# before\nfs.bos.retry.min.sleep.ms=500\nfs.bos.retry.max.sleep.ms=500   # must be strictly greater\n\n# after\nfs.bos.retry.min.sleep.ms=100\nfs.bos.retry.max.sleep.ms=800","handlingStrategy":"validation","validationCode":"static void validateRetryWindow(int minSleep, int maxSleep) {\n  if (minSleep < 0 || maxSleep <= minSleep) {\n    throw new IllegalArgumentException(\n        \"require 0 <= minSleep < maxSleep, got min=\" + minSleep + \" max=\" + maxSleep);\n  }\n}\n// validateRetryWindow(cfgMin, cfgMax) before building BosRandomRetryPolicy","typeGuard":null,"tryCatchPattern":"catch (IllegalArgumentException e) {\n  // startup/config failure: correct the fs.bos min/max sleep properties and redeploy\n}","preventionTips":["Keep retry-sleep properties ordered: 0 <= min < max (strict)","Lint site XML for transposed or equal min/max values","Add a config smoke test that initializes the FileSystem before rollout"],"tags":["bos","retry-policy","invalid-config","illegal-argument","hadoop"],"backgroundTag":"invalid-config-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}