attribute data mixup when subscribing to multiple devices

Hello,

I have a use-case where I subscribe to the change events of several attributes from 8 different devices. The attribute names from each device are exactly the same, and I repeat the subscription for each device.


for (auto& devadr : listOfDevices) {
Tango::DeviceProxy* dev = groupOfDevices->get_device(devadr);
dev->subscribe_event("attr0", Tango::EventType::CHANGE_EVENT, callback, true);
dev->subscribe_event("attr1", Tango::EventType::CHANGE_EVENT, callback, true);
dev->subscribe_event("attr2", Tango::EventType::CHANGE_EVENT, callback, true);
dev->subscribe_event("attr3", Tango::EventType::CHANGE_EVENT, callback, true);
dev->subscribe_event("attr4", Tango::EventType::CHANGE_EVENT, callback, true);
dev->subscribe_event("attr5", Tango::EventType::CHANGE_EVENT, callback, true);
}


The event subscription and callback works just fine. Each device generates a change event at about the same time and my subscriber device receives all the events. However, when I extract the attribute data inside the callback (from say device A), I often get attribute data from device B instead. Attribute names are never mixed up. I never see attr2 data when I expected attr1 for example.

I tried switching to pulling events, rather than the push method, and I tried the attribute to different types (extracting a vector of DevLong64 as well as pointer to DevVarLong64Array). The behaviour is the same.

It seems as though the attribute data I extract in the callback is actually buffered data from a previous or just newly arrived event for an attribute with the same name from a different device.

Has anyone else seen this behaviour?

Thanks,
Mike
Another test I ran was to make the data length of each push_change_event() a different length for every device generating events. The expected result was that callback would extract a DevVarLong64Array with a length that corresponds to its device name.

For device spect0 -> length should be 10000, spect1 -> length 10001, spect4 -> length 10004, etc.

Here is the output of the callback method showing that is not the case:

Received tango://localhost:10000/rfind/backend/spect3/spectrum_rexx0 with size 10003
SpectrumCallBack::push_event() called
Event change called for attr tango://localhost:10000/rfind/backend/spect5/spectrum_rexx1 of device rfind/backend/spect5
Received tango://localhost:10000/rfind/backend/spect5/spectrum_rexx1 with size 10001
SpectrumCallBack::push_event() called
Event change called for attr tango://localhost:10000/rfind/backend/spect6/spectrum_rexx0 of device rfind/backend/spect6
Received tango://localhost:10000/rfind/backend/spect6/spectrum_rexx0 with size 10001
SpectrumCallBack::push_event() called
Event change called for attr tango://localhost:10000/rfind/backend/spect1/spectrum_rexx1 of device rfind/backend/spect1
Received tango://localhost:10000/rfind/backend/spect1/spectrum_rexx1 with size 10001
SpectrumCallBack::push_event() called
Event change called for attr tango://localhost:10000/rfind/backend/spect4/spectrum_rexx0 of device rfind/backend/spect4
Received tango://localhost:10000/rfind/backend/spect4/spectrum_rexx0 with size 10004


There are callbacks for devices spect5 and spect6 where the attribute data extracted was actually spect1's attribute.
Hi Mike,

It's the first time I hear this kind of issue, which sounds like a bug.
What version of the Tango C++ library are you using?
Could you please create an issue on cppTango git repository: https://gitlab.com/tango-controls/cppTango ?

Kind regards,
Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Thanks Reynald,

I've created issue #869 with the same text as in this forum post: https://gitlab.com/tango-controls/cppTango/-/issues/869

Update:
Looks like my issue #869 is a duplicate of issue #684.
https://gitlab.com/tango-controls/cppTango/-/issues/684

I'll report back here when I try out the suggested fix.
Edited 2 years ago
 
Register or login to create to post a reply.