{"record":{"id":"de0f89ceb55ad445","repo":"apache/druid","slug":"query-s-timed-out-de0f89","errorCode":null,"errorMessage":"Query [%s] timed out!","messagePattern":"Query \\[(.+?)\\] timed out!","errorType":"exception","errorClass":"QueryTimeoutException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/client/JsonParserIterator.java","lineNumber":219,"sourceCode":"          }\n          throw convertException(\n              new IAE(\n                  \"Next token wasn't a START_ARRAY, was[%s] from url[%s] with value[%s]\",\n                  jp.getCurrentToken(),\n                  url,\n                  errMsg\n              )\n          );\n        }\n      }\n      catch (ExecutionException | CancellationException e) {\n        throw convertException(e.getCause() == null ? e : e.getCause());\n      }\n      catch (IOException | InterruptedException e) {\n        throw convertException(e);\n      }\n      catch (TimeoutException e) {\n        throw new QueryTimeoutException(StringUtils.nonStrictFormat(\"Query [%s] timed out!\", queryId), host);\n      }\n    }\n  }\n\n  private QueryTimeoutException timeoutQuery()\n  {\n    return new QueryTimeoutException(StringUtils.nonStrictFormat(\"url[%s] timed out\", url), host);\n  }\n\n  /**\n   * Converts the given exception to a proper type of {@link QueryException}.\n   * The use cases of this method are:\n   * <p>\n   * - All non-QueryExceptions are wrapped with {@link QueryInterruptedException}.\n   * - The QueryException from {@link DirectDruidClient} is converted to a more specific type of QueryException\n   * based on {@link QueryException#getErrorCode()}. During conversion, {@link QueryException#host} is overridden\n   * by {@link #host}.\n   */","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/client/JsonParserIterator.java#L201-L237","documentation":"JsonParserIterator.init() waits (with timeout) for the next batch from a remote queryable server. When the wait exceeds the timeout it throws QueryTimeoutException with \"Query [%s] timed out!\", tagged with the host, indicating the remote server failed to deliver results in time.","triggerScenarios":"Remote broker/historical server slow or hung; large query exceeding configured HTTP/read timeout; network partition leaving the future incomplete until timeout; next()/hasNext() triggering lazy init on a stalled result stream.","commonSituations":"Distributed queries hitting an overloaded historical; config timeouts too low for heavy queries; dropped connections where the client never receives a response and waits until TimeoutException.","solutions":["Increase the query/HTTP timeout configuration (e.g. druid processing timeout or http timeout for the client)","Investigate the remote host named in the exception for load or GC issues","Retry the query, ideally with query failover to another server","Check network stability between client and server; look for dropped connections"],"exampleFix":"// before\n// default timeout too small\n// after\n// druid.broker.http.readTimeout=PT10M (and matching query context timeout)\nqueryContext.setTimeout(600000L);","handlingStrategy":"retry","validationCode":"// pre-check budget\nlong timeoutMs = queryContext.getTimeoutMs();\nif (timeoutMs <= 0) throw new IllegalArgumentException(\"query timeout must be positive\");","typeGuard":null,"tryCatchPattern":"try { rows.hasNext(); } catch (QueryTimeoutException e) { log.warn(\"query {} timed out on host {}\", queryId, e.getHost()); /* retry/failover */ }","preventionTips":["Set realistic query and HTTP timeouts","Monitor remote server load/GC pauses","Implement query retry with failover to healthy servers"],"tags":["timeout","distributed-query","network"],"backgroundTag":"request-timeout","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}