From 2b98facdc4872edc13d1cdac71b4e3761e89fec8 Mon Sep 17 00:00:00 2001 From: Abhishek Agarwal <1477457+abhishekagarwal87@users.noreply.github.com> Date: Fri, 11 Oct 2024 18:31:01 +0530 Subject: [PATCH] MSQ WorkerResource: Fix timeout handler for httpGetChannelData. (#17328) (#17330) The timeout handler should fire if the response has not been handled yet (i.e. if responseResolved was previously false). However, it erroneously fires only if the response *was* handled. This causes HTTP 500 errors if the timeout actually does fire. The timeout is 30 seconds, which can be hit during pipelined queries, if an earlier stage of the query hasn't produced its first frame within 30 seconds. This fixes a regression introduced in #17140. Co-authored-by: Gian Merlino --- .../java/org/apache/druid/msq/rpc/WorkerResource.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/rpc/WorkerResource.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/rpc/WorkerResource.java index 20758883ddba..fd6207662af8 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/rpc/WorkerResource.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/rpc/WorkerResource.java @@ -120,12 +120,10 @@ public void onComplete(AsyncEvent event) public void onTimeout(AsyncEvent event) { if (responseResolved.compareAndSet(false, true)) { - return; + HttpServletResponse response = (HttpServletResponse) asyncContext.getResponse(); + response.setStatus(HttpServletResponse.SC_OK); + event.getAsyncContext().complete(); } - - HttpServletResponse response = (HttpServletResponse) asyncContext.getResponse(); - response.setStatus(HttpServletResponse.SC_OK); - event.getAsyncContext().complete(); } @Override