mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Merge pull request #41343 from azat/deadlock-fix
Fix possible deadlock with async_socket_for_remote/use_hedged_requests and parallel KILL
This commit is contained in:
commit
f9e7451d88
@ -372,6 +372,12 @@ CancellationCode QueryStatus::cancelQuery(bool)
|
||||
|
||||
void QueryStatus::addPipelineExecutor(PipelineExecutor * e)
|
||||
{
|
||||
/// In case of asynchronous distributed queries it is possible to call
|
||||
/// addPipelineExecutor() from the cancelQuery() context, and this will
|
||||
/// lead to deadlock.
|
||||
if (is_killed.load())
|
||||
throw Exception("Query was cancelled", ErrorCodes::QUERY_WAS_CANCELLED);
|
||||
|
||||
std::lock_guard lock(executors_mutex);
|
||||
assert(std::find(executors.begin(), executors.end(), e) == executors.end());
|
||||
executors.push_back(e);
|
||||
|
Loading…
Reference in New Issue
Block a user