Destroy fiber in case of exception in cancelBefore in AsyncTaskExecutor (#55516)

* Destroy fiber in case of exception in cancelBefore in AsyncTaskExecutor

* Update AsyncTaskExecutor.cpp

---------

Co-authored-by: Alexey Milovidov <milovidov@clickhouse.com>
This commit is contained in:
Kruglov Pavel 2023-10-12 06:04:43 +02:00 committed by GitHub
parent 749412bfeb
commit 453de30ad6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,6 @@
#include <Common/AsyncTaskExecutor.h>
#include <base/scope_guard.h>
namespace DB
{
@ -46,8 +48,10 @@ void AsyncTaskExecutor::cancel()
{
std::lock_guard guard(fiber_lock);
is_cancelled = true;
cancelBefore();
destroyFiber();
{
SCOPE_EXIT({ destroyFiber(); });
cancelBefore();
}
cancelAfter();
}