Skip to content

Commit

Permalink
Merge pull request #44891 from makortel/fixPrePrefetchSelectionAsync
Browse files Browse the repository at this point in the history
Fix exception handling in Worker::prePrefetchSelectionAsync()
  • Loading branch information
cmsbuild authored May 3, 2024
2 parents 919ae75 + c90b071 commit 5004fc6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions FWCore/Framework/src/Worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ namespace edm {
edm::make_waiting_task([id, successTask, iPrincipal, this, weakToken, &group](std::exception_ptr const*) {
ServiceRegistry::Operate guard(weakToken.lock());
try {
convertException::wrap([&]() {
bool selected = convertException::wrap([&]() {
if (not implDoPrePrefetchSelection(id, *iPrincipal, &moduleCallingContext_)) {
timesRun_.fetch_add(1, std::memory_order_relaxed);
setPassed<true>();
Expand All @@ -173,9 +173,13 @@ namespace edm {
if (0 == successTask->decrement_ref_count()) {
TaskSentry s(successTask);
}
return;
return false;
}
return true;
});
if (not selected) {
return;
}

} catch (cms::Exception& e) {
e.addContext("Calling OutputModule prePrefetchSelection()");
Expand All @@ -187,7 +191,13 @@ namespace edm {
exceptionContext(ost, *streamContext);
e.addContext(ost.str());
}
setException<true>(std::current_exception());
waitingTasks_.doneWaiting(std::current_exception());
//TBB requires that destroyed tasks have count 0
if (0 == successTask->decrement_ref_count()) {
TaskSentry s(successTask);
}
return;
}
if (0 == successTask->decrement_ref_count()) {
group.run([successTask]() {
Expand Down

0 comments on commit 5004fc6

Please sign in to comment.