Merge pull request #62972 from ClickHouse/tavplubix-patch-10

Fix race in `executeJob` when updating exception message
This commit is contained in:
Raúl Marín 2024-04-29 09:53:40 +00:00 committed by GitHub
commit 379fea9a30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 6 deletions

View File

@ -64,11 +64,12 @@ static void executeJob(ExecutingGraph::Node * node, ReadProgressCallback * read_
}
}
}
catch (Exception & exception)
catch (Exception exception) /// NOLINT
{
/// Copy exception before modifying it because multiple threads can rethrow the same exception
if (checkCanAddAdditionalInfoToException(exception))
exception.addMessage("While executing " + node->processor->getName());
throw;
throw exception;
}
}

View File

@ -90,11 +90,8 @@ struct PushingAsyncPipelineExecutor::Data
void rethrowExceptionIfHas()
{
if (has_exception)
{
has_exception = false;
if (has_exception.exchange(false))
std::rethrow_exception(exception);
}
}
};