apache/druid · warning
Failed to cancel query
Error message
Failed to cancel query[%s] on server[%s]
What it means
Log warning in DataServerClient when the asynchronous HTTP call to cancel a query on a data server (historical/peon) fails. The client fires cancel requests to every server hosting the query; failure to cancel on one server is logged with the cause but does not affect the cancel result returned to the caller.
Solutions
- Check the embedded throwable to see if the server is down (connection refused) or returned an HTTP error.
- Verify the target server is healthy and reachable (its /status endpoint).
- Treat as benign if the query already completed — cancellation of finished queries commonly fails this way.
- If persistent, check data server logs for the query id and inspect httpClient settings (readTimeout, numConnections) in druid.http config.
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check server health before issuing cancel boolean healthy = httpClient.get(serverUrl + "/status/health").isSuccess();
Try / catch
future.cancel().addListener(() -> {
try { future.get(); }
catch (ExecutionException e) {
log.warn("Cancel on %s failed (may be benign if query finished): %s", location, e.getCause());
}
}); Prevention
- Treat single-server cancel failures as benign when the query already completed
- Monitor data-server availability; most failures are dead/restarting historicals
- Check data node logs by query id when failures are persistent
When it happens
Trigger: QueryResource.cancel POST to /druid/v2/{id} on a server returns an error or the FutureCallback's onFailure fires: server down, connection reset, query already completed on that server, or HTTP 4xx/5xx from the broker/data node.
Common situations: User cancels a query that has just finished on some servers; historical is restarting or unreachable; network partition between broker and data server; cancellation storm overloading data nodes.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Action [ ] failed for worker [ ] with status ( )
- An external HTTP table with a URI must also provide the…
- An external HTTP table with a URI must also provide the…
- AuthenticationToken ignored:
- <authResult.getErrorMessage()>
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/ae6cf1e988e1d2bd.
Report an issue: GitHub.
Appendix: source
Thrown at server/src/main/java/org/apache/druid/discovery/DataServerClient.java:188
new RequestBuilder(HttpMethod.DELETE, cancelPath).timeout(CANCELLATION_TIMEOUT),
IgnoreHttpResponseHandler.INSTANCE
);
Futures.addCallback(
cancelFuture,
new FutureCallback<>()
{
@Override
public void onSuccess(final Void result)
{
// Do nothing on successful cancellation.
}
@Override
public void onFailure(final Throwable t)
{
log.noStackTrace()
.warn(t, "Failed to cancel query[%s] on server[%s]", queryId, serviceLocation.getHostAndPort());
}
},
Execs.directExecutor()
);
}
}
View on GitHub (pinned to 9b90983fd2)