Cancel PipelineExecutor properly in case of exception in spawnThreads

This commit is contained in:
Kruglov Pavel 2023-11-22 14:43:52 +01:00 committed by GitHub
parent 9fb1acc947
commit e1904cbdf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -300,8 +300,18 @@ void PipelineExecutor::executeStepImpl(size_t thread_num, std::atomic_bool * yie
context.processing_time_ns += processing_time_watch.elapsed();
#endif
try
{
/// Upscale if possible.
spawnThreads();
}
catch (...)
{
/// spawnThreads can throw an exception, for example CANNOT_SCHEDULE_TASK.
/// We should cancel execution properly before rethrow.
cancel();
throw;
}
/// We have executed single processor. Check if we need to yield execution.
if (yield_flag && *yield_flag)