Skip to content

Dispatcher shallow copy - #16202

Open
Barthelemy wants to merge 3 commits into
AliceO2Group:devfrom
Barthelemy:dispatcher-shallow-copy
Open

Barthelemy wants to merge 3 commits into
AliceO2Group:devfrom
Barthelemy:dispatcher-shallow-copy

Conversation

@Barthelemy

Copy link
Copy Markdown
Collaborator

The Dispatcher no longer deep-copies sampled payloads but uses forwardPayload.

STFSender cannot run on Mac, thus I asked Claude to build a test (dataSamplingSharedPayload) that makes sure we can forward data and that the data is readable by several agents.

The Dispatcher no longer deep-copies sampled payloads but uses `forwardPayload`.

STFSender cannot run on Mac, thus I asked Claude to build a test (dataSamplingSharedPayload) that makes sure we can forward data and that the data is readable by several agents.
@Barthelemy Barthelemy changed the title [WIP] Dispatcher shallow copy Dispatcher shallow copy Nov 27, 2026
const auto* inputHeader = DataRefUtils::getHeader<header::DataHeader*>(inputData);
dataAllocator.snapshot(output, inputData.payload, DataRefUtils::getPayloadSize(inputData), inputHeader->payloadSerializationMethod);
const auto payloadSize = DataRefUtils::getPayloadSize(inputData);
// Shallow copy when we have the original message and it is exactly the payload described by the header.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which cases that would not be true?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed that is overly protective.

  • inputPayload->GetData() == inputData.payload should never happen, I will remove it.
  • inputPayload can be theoretically nullptr right ? I would keep it.
  • And inputPayload->GetSize() == payloadSize is improbable, I will remove it too.
    ok for you ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with what was reduced, but I am wondering why not go further. Should we ever get a nullptr with valid data? If yes - will falling back to snapshot help? If not - shouldn't we just print an error and skip dispatching the message? And to be clear, I don't know the answers myself.

I would see a reason to keep the snapshot fallback for debugging/validating/comparing the new and old way, switched with an env var. But if we keep as it is now, it will be difficult to know if forwarding works in production or we just fall back silently into snapshot.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean and I agree.
Let's print a message and carry on then.

/// \file dataSamplingSharedPayload.cxx
/// \brief Stress test of the Dispatcher forwarding payloads by shallow copy.
///
/// The producer mimics STFSender: payloads live in an unmanaged shared memory region and are

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly what happens in the file, claude did not really understand what STFSender does, since it modeled it as a producer which sends data into the DPL workflow. Meanwhile, on an FLP, STFSender sits downstream the FLP DPL workflow.

The concern I had in the ticket was that STFSender would attempt to delete a shared message before it is processed by a local QC task. Is this really tested here? Sorry, the code is a bit long and low-level, so I didn't spend a lot of time trying to follow it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants