Fix SIGSEGV for distributed queries on failures

Since after pull(), cancel() will be called, and this will lead to
SIGSEGV, since there is no exception, but has_exception was not reseted
in pull()
This commit is contained in:
Azat Khuzhin 2021-03-03 23:41:24 +03:00
parent 6a6bc3924d
commit e858dae187
3 changed files with 9 additions and 2 deletions

View File

@ -110,8 +110,7 @@ bool PullingAsyncPipelineExecutor::pull(Chunk & chunk, uint64_t milliseconds)
data->thread = ThreadFromGlobalPool(std::move(func)); data->thread = ThreadFromGlobalPool(std::move(func));
} }
if (data->has_exception) data->rethrowExceptionIfHas();
std::rethrow_exception(std::move(data->exception));
bool is_execution_finished = lazy_format ? lazy_format->isFinished() bool is_execution_finished = lazy_format ? lazy_format->isFinished()
: data->is_finished.load(); : data->is_finished.load();

View File

@ -0,0 +1,8 @@
-- this is enough to trigger the regression
SELECT throwIf(dummy = 0) FROM remote('127.1', system.one); -- { serverError 395 }
-- these are just in case
SELECT throwIf(dummy = 0) FROM remote('127.{1,2}', system.one); -- { serverError 395 }
SELECT throwIf(dummy = 0) FROM remote('127.{1,2}', system.one) SETTINGS prefer_localhost_replica=0; -- { serverError 395 }
SELECT throwIf(dummy = 0) FROM remote('127.{1,2}', system.one) SETTINGS prefer_localhost_replica=0, distributed_group_by_no_merge=1; -- { serverError 395 }
SELECT throwIf(dummy = 0) FROM remote('127.{1,2}', system.one) SETTINGS prefer_localhost_replica=0, distributed_group_by_no_merge=2; -- { serverError 395 }