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.
Another test I ran was to make the data length of each push_change_event() a different length for the 8 devices 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. There are callbacks for devices spect5 and spect6 where the attribute data extracted was actually spect1's attribute:
...
SpectrumCallBack::push_event() called
Event change called for attr tango://localhost:10000/rfind/backend/spect3/spectrum_rexx0 of device rfind/backend/spect3
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
...
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.
I'm using cppTango release 9.3.4.