Fix 'Empty task was returned from async task queue' on query cancellation

This commit is contained in:
Azat Khuzhin 2021-02-18 21:28:42 +03:00
parent 45119fce4f
commit 9c01869090
3 changed files with 17 additions and 0 deletions

View File

@ -540,7 +540,12 @@ void PipelineExecutor::executeStepImpl(size_t thread_num, size_t num_threads, st
/// If we execute in single thread, wait for async tasks here. /// If we execute in single thread, wait for async tasks here.
auto res = async_task_queue.wait(lock); auto res = async_task_queue.wait(lock);
if (!res) if (!res)
{
/// The query had been cancelled (finished is also set)
if (finished)
break;
throw Exception("Empty task was returned from async task queue", ErrorCodes::LOGICAL_ERROR); throw Exception("Empty task was returned from async task queue", ErrorCodes::LOGICAL_ERROR);
}
node = static_cast<ExecutingGraph::Node *>(res.data); node = static_cast<ExecutingGraph::Node *>(res.data);
break; break;

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
# regression for 'Empty task was returned from async task queue' during query
# cancellation with async_socket_for_remote=1 (that ignores
# max_distributed_connections)
timeout 5s ${CLICKHOUSE_CLIENT} --max_distributed_connections=1 --format Null -q "select * from remote('127.{2..11}', view(select * from numbers(1e9))) group by number format Null"
# timedout
test $? -eq 124