Problems with adding/removing dynamic attributes in version 9.4
We hit this issue in the Sardana project when trying it with PyTango 9.4 release candidates.
More information in: sardana-org/sardana#1810 (closed)
Link to the repo with the complete demo example: https://gitlab.com/reszelaz/test-tango-removeattr-9.4
Environment
This issue happens with the following conda environment:
conda create -n sardana_pytango_rc2 -c conda-forge/label/pytango_rc -c conda-forge python=3.10 pytango=9.4.0rc2
It works correctly with:
conda create -n sardana_pytango_stable -c conda-forge python=3.10 pytango
Steps to reproduce
-
Register in Tango Database one
DeviceServer
DS with instance nametest
with:- 1 device of
PoolDevice
class, with the following name:test/pooldevice/1
tango_admin --add-server DeviceServer/test PoolDevice test/pooldevice/1
- 1 device of
-
Start
DeviceServer
:python3 DeviceServer.py test
-
Start client:
python3 client.py
Result
DeviceServer
reports the following error when trying to create third device of MyDevice
class:
Ready to accept request
remove device attribute: Attr1
remove device attribute: Attr1
Failed to initialize dynamic attributes
DevFailed[
DevError[
desc = Device --> a/b/c
Property writable_attr_name for attribute attr1 is set to Attr1, but this attribute does not exist
origin = void Tango::MultiAttribute::check_associated(long int, const string&) at (/home/conda/feedstock_root/build_artifacts/cpptango_1667919173430/work/cppapi/server/multiattribute.cpp:570)
reason = API_AttrOptProp
severity = ERR]
DevError[
desc = Attribute Attr1 is not defined as attribute for your device.
Can't remove it
origin = void Tango::DeviceImpl::remove_attribute(const string&, bool, bool) at (/home/conda/feedstock_root/build_artifacts/cpptango_1667919173430/work/cppapi/server/device.cpp:3784)
reason = API_AttrNotFound
severity = ERR]
]
When debugging it I realized that the device_attr_names
contains:
-
['State', 'Status']
for the first device -
['Attr1', 'State', 'Status']
for the second device -
['attr1', 'Attr1', 'State', 'Status']
for the third device, and here it fails.
Edited by Zbigniew Reszela