Skip to content

Commit 8bc0bbc

Browse files
committed
DPL: sanity check silently skipping DataProcessingDevice
When either DomainInfoHeader or SourceInfoHeader is present, we skip their processing. However we should complain if actual data is attached to the same message, because it will also be skipped.
1 parent a807b70 commit 8bc0bbc

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

Framework/Core/src/DataProcessingDevice.cxx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -558,25 +558,18 @@ static auto toBeForwardedHeader = [](void* header) -> bool {
558558
if (header == nullptr) {
559559
return false;
560560
}
561-
auto sih = o2::header::get<SourceInfoHeader*>(header);
562-
if (sih) {
563-
return false;
564-
}
565-
566-
auto dih = o2::header::get<DomainInfoHeader*>(header);
567-
if (dih) {
568-
return false;
569-
}
570-
571561
auto dh = o2::header::get<DataHeader*>(header);
572562
if (!dh) {
573563
return false;
574564
}
575-
auto dph = o2::header::get<DataProcessingHeader*>(header);
576-
if (!dph) {
577-
return false;
565+
bool retval = !o2::header::get<SourceInfoHeader*>(header) &&
566+
!o2::header::get<DomainInfoHeader*>(header) &&
567+
o2::header::get<DataProcessingHeader*>(header);
568+
// DataHeader is there. Complain if we have unexpected headers present / missing
569+
if (!retval) {
570+
LOGP(error, "Dropping data because of malformed header structure");
578571
}
579-
return true;
572+
return retval;
580573
};
581574

582575
static auto toBeforwardedMessageSet = [](std::vector<ChannelIndex>& cachedForwardingChoices,
@@ -1858,21 +1851,27 @@ void DataProcessingDevice::handleData(ServiceRegistryRef ref, InputChannelInfo&
18581851
for (size_t pi = 0; pi < parts.Size(); pi += 2) {
18591852
auto* headerData = parts.At(pi)->GetData();
18601853
auto sih = o2::header::get<SourceInfoHeader*>(headerData);
1854+
auto dh = o2::header::get<DataHeader*>(headerData);
18611855
if (sih) {
18621856
O2_SIGNPOST_EVENT_EMIT(device, cid, "handle_data", "Got SourceInfoHeader with state %d", (int)sih->state);
18631857
info.state = sih->state;
18641858
insertInputInfo(pi, 2, InputType::SourceInfo, info.id);
18651859
state.lastActiveDataProcessor = &context;
1860+
if (dh) {
1861+
LOGP(error, "Found data attached to a SourceInfoHeader");
1862+
}
18661863
continue;
18671864
}
18681865
auto dih = o2::header::get<DomainInfoHeader*>(headerData);
18691866
if (dih) {
18701867
O2_SIGNPOST_EVENT_EMIT(device, cid, "handle_data", "Got DomainInfoHeader with oldestPossibleTimeslice %d", (int)dih->oldestPossibleTimeslice);
18711868
insertInputInfo(pi, 2, InputType::DomainInfo, info.id);
18721869
state.lastActiveDataProcessor = &context;
1870+
if (dh) {
1871+
LOGP(error, "Found data attached to a DomainInfoHeader");
1872+
}
18731873
continue;
18741874
}
1875-
auto dh = o2::header::get<DataHeader*>(headerData);
18761875
if (!dh) {
18771876
insertInputInfo(pi, 0, InputType::Invalid, info.id);
18781877
O2_SIGNPOST_EVENT_EMIT_ERROR(device, cid, "handle_data", "Header is not a DataHeader?");

0 commit comments

Comments
 (0)