apache/hadoop · error · IOException
Invalid timeout [timeout = {connectionTimeout} ms]
Error message
Invalid timeout [timeout = {connectionTimeout} ms] What it means
Fetcher.connect() slices the configured connect timeout into unit attempts (each capped at UNIT_CONNECT_TIMEOUT) and retries until the total budget is spent. A negative mapreduce.reduce.shuffle.connect.timeout cannot be sliced, so every connect attempt of the task fails immediately with this IOException.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/task/reduce/Fetcher.java:706
url.append(mapId);
first = false;
}
if (LOG.isDebugEnabled()) {
LOG.debug("MapOutput URL for " + host + " -> " + url.toString());
}
return new URL(url.toString());
}
/**
* The connection establishment is attempted multiple times and is given up
* only on the last failure. Instead of connecting with a timeout of
* X, we try connecting with a timeout of x < X but multiple times.
*/
private void connect(URLConnection connection, int connectionTimeout) throws IOException {
int unit = 0;
if (connectionTimeout < 0) {
throw new IOException("Invalid timeout "
+ "[timeout = " + connectionTimeout + " ms]");
} else if (connectionTimeout > 0) {
unit = Math.min(UNIT_CONNECT_TIMEOUT, connectionTimeout);
}
long startTime = Time.monotonicNow();
long lastTime = startTime;
int attempts = 0;
// set the connect timeout to the unit-connect-timeout
connection.setConnectTimeout(unit);
while (true) {
try {
attempts++;
connection.connect();
break;
} catch (IOException ioe) {
long currentTime = Time.monotonicNow();
long retryTime = currentTime - startTime;
long leftTime = connectionTimeout - retryTime;View on GitHub (pinned to 2add963021)
Solutions
- Set mapreduce.reduce.shuffle.connect.timeout to a positive millisecond value (default 130000).
- Remove the override entirely to fall back to the default.
- If the intent was 'no timeout', use a large positive value such as 600000 instead of -1.
Example fix
// before
conf.setInt("mapreduce.reduce.shuffle.connect.timeout", -1);
// after
conf.setInt("mapreduce.reduce.shuffle.connect.timeout", 130000); Defensive patterns
Strategy: validation
Validate before calling
// Validate shuffle timeouts before job submission
int connectTimeout = conf.getInt("mapreduce.reduce.shuffle.connect.timeout", 130000);
int readTimeout = conf.getInt("mapreduce.reduce.shuffle.read.timeout", 80000);
if (connectTimeout <= 0 || readTimeout <= 0) { throw new IllegalArgumentException("Shuffle timeouts must be positive milliseconds: connect=" + connectTimeout + ", read=" + readTimeout); } Prevention
- Treat -1 timeout conventions from other systems as invalid for MapReduce shuffle settings.
- Add a config sanity check in job launch scripts that scans mapreduce.*.timeout keys for negative values.
When it happens
Trigger: Job configuration sets mapreduce.reduce.shuffle.connect.timeout to a negative value, typically -1 by convention from other systems where it means 'infinite'.
Common situations: Copying timeout settings from other frameworks (curl, netty, postgres) where -1 disables the timeout; templates or variable substitution producing -1; misparsed integer in the job xml.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Invalid value for mapreduce.reduce.shuffle.input.buffer.perc
- Invalid value for mapreduce.reduce.shuffle.memory.limit.perc
- Invalid configuration: maxSingleShuffleLimit should be less
- {maxRedPer}: mapreduce.reduce.input.buffer.percent must be a
- Malformed xml formation queue tag and acls tags or state ta
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/bd5c62af5bd52e0d.
Report an issue: GitHub.