Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set interrupted flag after pushing an error to prevent race condition where the InterruptException could end up being the top-level error #10337

Merged
merged 1 commit into from Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/parallel/executor.cpp
Expand Up @@ -554,10 +554,10 @@ vector<LogicalType> Executor::GetTypes() {
}

void Executor::PushError(PreservedError exception) {
// interrupt execution of any other pipelines that belong to this executor
context.interrupted = true;
// push the exception onto the stack
error_manager.PushError(std::move(exception));
// interrupt execution of any other pipelines that belong to this executor
context.interrupted = true;
}

bool Executor::HasError() {
Expand Down
6 changes: 4 additions & 2 deletions test/sqlite/sqllogic_command.cpp
Expand Up @@ -177,8 +177,10 @@ void LoopCommand::ExecuteInternal(ExecuteContext &context) const {
LoopDefinition loop_def = definition;
loop_def.loop_idx = definition.loop_start;
if (loop_def.is_parallel) {
if (context.is_parallel || !context.running_loops.empty()) {
throw std::runtime_error("Nested parallel loop commands not allowed");
for (auto &running_loop : context.running_loops) {
if (running_loop.is_parallel) {
throw std::runtime_error("Nested parallel loop commands not allowed");
}
}
// parallel loop: launch threads
std::list<ParallelExecuteContext> contexts;
Expand Down
4 changes: 0 additions & 4 deletions test/sqlite/sqllogic_test_runner.cpp
Expand Up @@ -53,10 +53,6 @@ void SQLLogicTestRunner::StartLoop(LoopDefinition definition) {
auto loop = make_uniq<LoopCommand>(*this, std::move(definition));
auto loop_ptr = loop.get();
if (InLoop()) {
// already in a loop: add it to the currently active loop
if (definition.is_parallel) {
throw std::runtime_error("concurrent loop must be the outer-most loop!");
}
active_loops.back()->loop_commands.push_back(std::move(loop));
} else {
// not in a loop yet: new top-level loop
Expand Down