fix http readonly request stucks on client close

This commit is contained in:
Alexander Tokmakov 2020-05-05 23:32:34 +03:00
parent 114f09cfca
commit d35150ecf3
4 changed files with 10 additions and 4 deletions

4
.gitmodules vendored
View File

@ -1,7 +1,7 @@
[submodule "contrib/poco"]
path = contrib/poco
url = https://github.com/ClickHouse-Extras/poco
branch = clickhouse
url = https://github.com/tavplubix/poco
branch = respect_msg_dontwait
[submodule "contrib/zstd"]
path = contrib/zstd
url = https://github.com/facebook/zstd.git

2
contrib/poco vendored

@ -1 +1 @@
Subproject commit 7d605a1ae5d878294f91f68feb62ae51e9a04426
Subproject commit a71e0776531861873144e4c4081204ea1a1258fb

View File

@ -567,7 +567,6 @@ void HTTPHandler::processQuery(
try
{
char b;
//FIXME looks like MSG_DONTWAIT is useless because of POCO_BROKEN_TIMEOUTS
int status = socket.receiveBytes(&b, 1, MSG_DONTWAIT | MSG_PEEK);
if (status == 0)
context.killCurrentQuery();

View File

@ -10,3 +10,10 @@ do
${CLICKHOUSE_CURL} -sS --data "SELECT count() FROM system.processes WHERE query_id = 'cancel_http_readonly_queries_on_client_close'" "${CLICKHOUSE_URL}" | grep '0' && break
sleep 0.2
done
${CLICKHOUSE_CURL} -sS -X POST "${CLICKHOUSE_URL}&session_id=test_00834_session&readonly=2&cancel_http_readonly_queries_on_client_close=1" -d "CREATE TEMPORARY TABLE table_tmp AS SELECT 1 FORMAT JSON"
${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&session_id=test_00834_session&query=DROP+TEMPORARY+TABLE+table_tmp"
url_https="https://${CLICKHOUSE_HOST}:${CLICKHOUSE_PORT_HTTPS}/?session_id=test_00834_session"
${CLICKHOUSE_CURL} -sSk "$url_https&readonly=2&cancel_http_readonly_queries_on_client_close=1" -d "CREATE TEMPORARY TABLE table_tmp AS SELECT 1 FORMAT JSON"
${CLICKHOUSE_CURL} -sSk "$url_https&session_id=test_00834_session&query=DROP+TEMPORARY+TABLE+table_tmp"