{"action":"created","issue":{"url":"https://api.github.com/repos/druid-io/druid/issues/2331","labels_url":"https://api.github.com/repos/druid-io/druid/issues/2331/labels{/name}","comments_url":"https://api.github.com/repos/druid-io/druid/issues/2331/comments","events_url":"https://api.github.com/repos/druid-io/druid/issues/2331/events","html_url":"https://github.com/druid-io/druid/issues/2331","id":128634027,"number":2331,"title":"introduce mechanism to limit response context size","user":{"login":"himanshug","id":246308,"avatar_url":"https://avatars.githubusercontent.com/u/246308?v=3","gravatar_id":"","url":"https://api.github.com/users/himanshug","html_url":"https://github.com/himanshug","followers_url":"https://api.github.com/users/himanshug/followers","following_url":"https://api.github.com/users/himanshug/following{/other_user}","gists_url":"https://api.github.com/users/himanshug/gists{/gist_id}","starred_url":"https://api.github.com/users/himanshug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/himanshug/subscriptions","organizations_url":"https://api.github.com/users/himanshug/orgs","repos_url":"https://api.github.com/users/himanshug/repos","events_url":"https://api.github.com/users/himanshug/events{/privacy}","received_events_url":"https://api.github.com/users/himanshug/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-01-25T20:45:11Z","updated_at":"2016-01-26T04:08:40Z","closed_at":null,"body":"druid query response can contain header \"X-Druid-Response-Context\" which is unbounded in size and can lead to exception like below.\r\n```\r\n2015-12-16T17:33:21,646 WARN [qtp296974277-44] org.eclipse.jetty.server.HttpChannel - /druid/v2/?pretty\r\njava.io.IOException: Response header too large\r\n    at org.eclipse.jetty.http.HttpGenerator.generateResponse(HttpGenerator.java:400) ~[jetty-http-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    at org.eclipse.jetty.server.HttpConnection$SendCallback.process(HttpConnection.java:599) ~[jetty-server-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:246) ~[jetty-util-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:208) ~[jetty-util-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    at org.eclipse.jetty.server.HttpConnection.send(HttpConnection.java:448) ~[jetty-server-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    at org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:762) ~[jetty-server-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    at org.eclipse.jetty.server.HttpChannel.write(HttpChannel.java:800) ~[jetty-server-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:139) ~[jetty-server-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:132) ~[jetty-server-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:347) ~[jetty-server-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n...\r\nCaused by: java.nio.BufferOverflowException\r\n    at java.nio.Buffer.nextPutIndex(Buffer.java:521) ~[?:1.8.0_51]\r\n    at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:169) ~[?:1.8.0_51]\r\n    at org.eclipse.jetty.http.HttpGenerator.putSanitisedValue(HttpGenerator.java:1057) ~[jetty-http-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    at org.eclipse.jetty.http.HttpGenerator.putTo(HttpGenerator.java:1079) ~[jetty-http-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    at org.eclipse.jetty.http.HttpGenerator.generateHeaders(HttpGenerator.java:703) ~[jetty-http-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    at org.eclipse.jetty.http.HttpGenerator.generateResponse(HttpGenerator.java:385) ~[jetty-http-9.2.5.v20141112.jar:9.2.5.v20141112]\r\n    ... 74 more\r\n```\r\n\r\nthere should be a mechanism to configure the header size in jetty and also a way to enforce that limit w/o getting jetty exceptions and query failure.\r\n\r\n\r\nit was exposed in https://github.com/druid-io/druid/issues/2108"},"comment":{"url":"https://api.github.com/repos/druid-io/druid/issues/comments/174808553","html_url":"https://github.com/druid-io/druid/issues/2331#issuecomment-174808553","issue_url":"https://api.github.com/repos/druid-io/druid/issues/2331","id":174808553,"user":{"login":"himanshug","id":246308,"avatar_url":"https://avatars.githubusercontent.com/u/246308?v=3","gravatar_id":"","url":"https://api.github.com/users/himanshug","html_url":"https://github.com/himanshug","followers_url":"https://api.github.com/users/himanshug/followers","following_url":"https://api.github.com/users/himanshug/following{/other_user}","gists_url":"https://api.github.com/users/himanshug/gists{/gist_id}","starred_url":"https://api.github.com/users/himanshug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/himanshug/subscriptions","organizations_url":"https://api.github.com/users/himanshug/orgs","repos_url":"https://api.github.com/users/himanshug/repos","events_url":"https://api.github.com/users/himanshug/events{/privacy}","received_events_url":"https://api.github.com/users/himanshug/received_events","type":"User","site_admin":false},"created_at":"2016-01-26T04:08:40Z","updated_at":"2016-01-26T04:08:40Z","body":"ok, it doesn't matter whether we have one header for each element in the responseContext map ...jetty uses one Buffer to hold all the headers.\r\nbest we can do really is to truncate the result of `jsonMapper.writeValueAsString(responseContext)` to 4k-8k or something. and it should be ok or else query will fail if responseContext accidentally has more stuff than 8k."}}