apache/hadoop · error · IllegalArgumentException
min sleep time must be positive number and max sleep time mu
Error message
min sleep time must be positive number and max sleep time must be greater than min sleep time !
What it means
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.
Source
Thrown at hadoop-cloud-storage-project/hadoop-bos/src/main/java/org/apache/hadoop/fs/bos/BosRandomRetryPolicy.java:58
private TimeUnit timeUnit;
private int minSleep;
private int maxSleep;
/**
* Constructs a BosRandomRetryPolicy.
*
* @param maxRetries the maximum number of retries
* @param minSleep the minimum sleep time
* @param maxSleep the maximum sleep time
* @param timeUnit the time unit for sleep values
* @throws IllegalArgumentException if minSleep is negative
* or maxSleep is not greater than minSleep
*/
public BosRandomRetryPolicy(
int maxRetries, int minSleep,
int maxSleep, TimeUnit timeUnit) {
if (minSleep < 0 || maxSleep <= minSleep) {
throw new IllegalArgumentException(
"min sleep time must be positive number and"
+ " max sleep time must be greater than"
+ " min sleep time !");
}
this.maxRetries = maxRetries;
this.minSleep = minSleep;
this.maxSleep = maxSleep;
this.timeUnit = timeUnit;
}
/**
* Determines whether the operation should be retried.
*
* @param e the exception that triggered the retry
* @param retries the number of retries so far
* @param failovers the number of failovers so far
* @param isIdempotentOrAtMostOnce whether the operation is
* idempotent or at-most-onceView on GitHub (pinned to 2add963021)
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
Example fix
# before fs.bos.retry.min.sleep.ms=500 fs.bos.retry.max.sleep.ms=500 # must be strictly greater # after fs.bos.retry.min.sleep.ms=100 fs.bos.retry.max.sleep.ms=800
Defensive patterns
Strategy: validation
Validate before calling
static void validateRetryWindow(int minSleep, int maxSleep) {
if (minSleep < 0 || maxSleep <= minSleep) {
throw new IllegalArgumentException(
"require 0 <= minSleep < maxSleep, got min=" + minSleep + " max=" + maxSleep);
}
}
// validateRetryWindow(cfgMin, cfgMax) before building BosRandomRetryPolicy Try / catch
catch (IllegalArgumentException e) {
// startup/config failure: correct the fs.bos min/max sleep properties and redeploy
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Path must be absolute: " + path
- Append is not supported by BaiduBosFileSystem
- RequestRateLimitExceeded
- status code 429 !!!" + e.getCause()
- Invalid read parameters: buf.length=%d, off=%d, len=%d
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/87da842a41721716.
Report an issue: GitHub.