From 0ea85b5ee8c6a84ecc6e0832b8e885097e5d6f8b Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Fri, 27 Nov 2026 07:15:46 +0100 Subject: [PATCH] DPL: dispatch only what is ready now, not the last call's actions too tryDispatchComputation appends what getReadyToProcess finds to the vector it is given and then dispatches everything in it. Every caller cleared the vector first except the end-of-stream drain in doHousekeeping, which calls it in a loop with the same vector. When that loop goes round more than once, the second call dispatches the first call's actions again, on slots which have been consumed since, and the task is handed an empty input: InputRecord::get then crashes. Without a thread pool the backlog at end of stream is rarely more than one round, so this hardly shows. With one, whatever arrived while a task was running is still there at end of stream, and SimpleWildcard02 and RootTreeReader crashed in InputRecord::get from exactly this path. The same loop is upstream. Clear the vector where it is filled, so it only ever holds this call's actions, and drop the callers' own clears, which are now redundant. --- Framework/Core/src/DataProcessingDevice.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Framework/Core/src/DataProcessingDevice.cxx b/Framework/Core/src/DataProcessingDevice.cxx index 50ca392cff519..b181eda458056 100644 --- a/Framework/Core/src/DataProcessingDevice.cxx +++ b/Framework/Core/src/DataProcessingDevice.cxx @@ -1688,7 +1688,6 @@ void DataProcessingDevice::doRun(ServiceRegistryRef ref) return; } - streamContext.completed.clear(); streamContext.completed.reserve(16); if (DataProcessingDevice::tryDispatchComputation(ref, streamContext.completed)) { state.lastActiveDataProcessor.store(&context); @@ -1704,7 +1703,6 @@ void DataProcessingDevice::doRun(ServiceRegistryRef ref) state.lastActiveDataProcessor = &context; } - streamContext.completed.clear(); if (DataProcessingDevice::tryDispatchComputation(ref, streamContext.completed)) { state.lastActiveDataProcessor = &context; } @@ -2347,6 +2345,9 @@ bool DataProcessingDevice::tryDispatchComputation(ServiceRegistryRef ref, std::v } }; + // Only what is ready now: the end-of-stream drain calls this in a loop with the + // same vector, and whatever the last call dispatched has been consumed since. + completed.clear(); ref.get().getReadyToProcess(completed); if (completed.empty() == true) { LOGP(debug, "No computations available for dispatching.");