Repository navigation
Dispatcher shallow copy - #16202
Dispatcher shallow copy#16202Barthelemy wants to merge 3 commits into
Conversation
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.
| 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. |
There was a problem hiding this comment.
In which cases that would not be true?
There was a problem hiding this comment.
indeed that is overly protective.
inputPayload->GetData() == inputData.payloadshould never happen, I will remove it.inputPayloadcan be theoretically nullptr right ? I would keep it.- And
inputPayload->GetSize() == payloadSizeis improbable, I will remove it too.
ok for you ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
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.