From 4dccfda61df2a18702a74d43a0eeb2e3c98784c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20L=C3=A9aut=C3=A9?= Date: Wed, 26 Nov 2014 21:35:01 -0800 Subject: [PATCH] fix query timeouts not being raised by broker --- .../io/druid/client/DirectDruidClient.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/server/src/main/java/io/druid/client/DirectDruidClient.java b/server/src/main/java/io/druid/client/DirectDruidClient.java index c354bc18259..2143f31f41a 100644 --- a/server/src/main/java/io/druid/client/DirectDruidClient.java +++ b/server/src/main/java/io/druid/client/DirectDruidClient.java @@ -159,15 +159,20 @@ public class DirectDruidClient implements QueryRunner byteCount += response.getContent().readableBytes(); try { - final Map responseContext = objectMapper.readValue( - response.headers().get("X-Druid-Response-Context"), new TypeReference>() - { - } - ); - context.putAll(responseContext); + final String responseContext = response.headers().get("X-Druid-Response-Context"); + // context may be null in case of error or query timeout + if (responseContext != null) { + context.putAll( + objectMapper.>readValue( + responseContext, new TypeReference>() + { + } + ) + ); + } } catch (IOException e) { - e.printStackTrace(); + log.error(e, "Unable to parse response context from url[%s]", url); } return super.handleResponse(response);