apache/druid · error · RE
Query[%s] timed out.
Error message
Query[%s] timed out.
What it means
DataServerResponseHandler's anonymous Enumeration.hasMoreElements() first rethrows any recorded failure as RE, then calls checkQueryTimeout(). If the query deadline (failTime) elapsed while waiting for data-server chunks, it throws QueryTimeoutException("Query[%s] timed out.").
Source
Thrown at server/src/main/java/org/apache/druid/discovery/DataServerResponseHandler.java:127
{
throw e;
}
}
);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException(e);
}
return ClientResponse.finished(
new SequenceInputStream(
new Enumeration<>()
{
@Override
public boolean hasMoreElements()
{
if (fail.get() != null) {
throw new RE(fail.get());
}
checkQueryTimeout();
// Done is always true until the last stream has be put in the queue.
// Then the stream should be spouting good InputStreams.
synchronized (done) {
return !done.get() || !queue.isEmpty();
}
}
@Override
public InputStream nextElement()
{
if (fail.get() != null) {
throw new RE(fail.get());
}
try {View on GitHub (pinned to 9b90983fd2)
Solutions
- Increase the query timeout in the query context (or maxTimeout config)
- Check data-server health and segment load times causing the delay
- Catch QueryTimeoutException and retry with a larger timeout or narrower query scope
Defensive patterns
Strategy: try-catch
Try / catch
try {
while (results.hasMoreElements()) { /* consume */ }
} catch (QueryTimeoutException e) {
log.warn("query timed out; resubmitting with larger budget");
// resubmit with increased timeout
} Prevention
- Set realistic query timeouts based on data volume
- Monitor data-server latency and segment load times
- Avoid large scans under very small timeout budgets
When it happens
Trigger: Iterating results of a native query whose data-server response takes longer than the query timeout; the deadline is checked on every hasMoreElements() call.
Common situations: Slow segment loads on historicals, overloaded data servers, overly strict timeout budget for large scans.
Understand the failure class
Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Query [%s] timed out
- Query timeout, cancelling pending results for query [%s]. Pe
- Failed to check missing segments due to missing responses fr
- Query error, cancelling pending results for query [%s]
- Incompatible aggregator factories, [this] and [other]
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/2eaef8961170474e.
Report an issue: GitHub.