Event properties are not checked on change/archive subscription? (v10.1+)

Hi

I've been working on a device that uses change_events/periodic_events/read_attribute, depending on which option is available first.

I've noticed that on client successfully subscribes to CHANGE events, even if there are no event properties set. And it sends one "Update" event!

Exactly the same behavior for ARCHIVE events, so I'll not paste the same log twice.

How to test:

Create conda env, conda install pytango=10.0.3. Start device, open python terminal (I've done it in different env with pytango=10.1.1)

Device env: pytango=10.0.3, cpptango=10.0.3
>>> import tango
>>> dev = tango.DeviceProxy('sys/pstest/1')
>>> dev.get_attribute_config_ex('test')[0].events
AttributeEventInfo(arch_event = ArchiveEventInfo(archive_abs_change = 'Not specified', archive_period = 'Not specified', archive_rel_change = 'Not specified', extensions = []), ch_event = ChangeEventInfo(abs_change = 'Not specified', extensions = [], rel_change = 'Not specified'), per_event = PeriodicEventInfo(extensions = [], period = '1000'))
>>> def cb(ev):
...     print(ev)
... 
>>> dev.subscribe_event('test', tango.EventType.CHANGE_EVENT, cb)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/envs/sardana/lib/python3.11/site-packages/tango/green.py", line 231, in greener
    return executor.run(fn, args, kwargs, wait=wait, timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/sardana/lib/python3.11/site-packages/tango/green.py", line 121, in run
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/sardana/lib/python3.11/site-packages/tango/utils.py", line 2743, in client_trace_wrapper
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/sardana/lib/python3.11/site-packages/tango/device_proxy.py", line 1664, in __DeviceProxy__subscribe_event
    return __DeviceProxy__subscribe_event_attrib(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/sardana/lib/python3.11/site-packages/tango/device_proxy.py", line 1898, in __DeviceProxy__subscribe_event_attrib
    event_id = self.__subscribe_event_attrib_with_sub_mode(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tango._tango.DevFailed: DevFailed[
    DevError[
        desc = Event properties (abs_change or rel_change) for attribute test are not set
        origin = void Tango::DServer::event_subscription(Tango::DeviceImpl&, const std::string&, const std::string&, const std::string&, Tango::ChannelType, int) at (/home/conda/feedstock_root/build_artifacts/cpptango_1758199895598/work/src/server/eventcmds.cpp:325)
        reason = API_EventPropertiesNotSet
        severity = ERR
    ],
    DevError[
        desc = Failed to execute command_inout on device dserver/powersupply/test, command ZmqEventSubscriptionChange
        origin = virtual Tango::DeviceData Tango::Connection::command_inout(const std::string&, const Tango::DeviceData&) at (/home/conda/feedstock_root/build_artifacts/cpptango_1758199986038/work/src/client/devapi_base.cpp:2029)
        reason = API_CommandFailed
        severity = ERR
    ],
    DevError[
        desc = Device server send exception while trying to register event
        origin = void Tango::EventConsumer::get_subscription_info(const std::shared_ptr<Tango::DeviceProxy>&, Tango::DeviceProxy*, std::string, std::string, Tango::DeviceData&, bool&) at (/home/conda/feedstock_root/build_artifacts/cpptango_1758199986038/work/src/client/event.cpp:2952)
        reason = API_DSFailedRegisteringEvent
        severity = ERR
    ]
]

Kill device server, conda install pytango=10.1.1, start device, in the same python terminal try to subscribe again.

Device env: pytango=10.1.1, cpptango=10.1.1
>>> dev.subscribe_event('test', tango.EventType.CHANGE_EVENT, cb)
EventData[
    attr_name = "tango://b-v-dummymax-csdb-0.maxiv.lu.se:10000/sys/pstest/1/test"
    attr_value = DeviceAttribute[
        data_format = <AttrDataFormat.SCALAR: 0>
        dim_x = 1
        dim_y = 0
        has_failed = False
        is_empty = False
        name = "test"
        nb_read = 1
        nb_written = 0
        quality = <AttrQuality.ATTR_VALID: 0>
        r_dimension = AttributeDimension[
            dim_x = 1
            dim_y = 0
        ]
        time = TimeVal(tv_nsec = 141, tv_sec = 1766504994, tv_usec = 494993)
        type = <CmdArgType.DevDouble: 5>
        value = 57.0
        w_dim_x = 0
        w_dim_y = 0
        w_dimension = AttributeDimension[
            dim_x = 0
            dim_y = 0
        ]
        w_value = None
    ]
    device = PowerSupply(sys/pstest/1)
    err = False
    errors = ()
    event = "change"
    event_reason = <EventReason.SubSuccess: 2>
    reception_date = TimeVal(tv_nsec = 240, tv_sec = 1766504994, tv_usec = 932196)
]
2
>>> EventData[
    attr_name = "tango://b-v-dummymax-csdb-0.maxiv.lu.se:10000/sys/pstest/1/test"
    attr_value = DeviceAttribute[
        data_format = <AttrDataFormat.SCALAR: 0>
        dim_x = 1
        dim_y = 0
        has_failed = False
        is_empty = False
        name = "test"
        nb_read = 1
        nb_written = 0
        quality = <AttrQuality.ATTR_VALID: 0>
        r_dimension = AttributeDimension[
            dim_x = 1
            dim_y = 0
        ]
        time = TimeVal(tv_nsec = 522, tv_sec = 1766504995, tv_usec = 495873)
        type = <CmdArgType.DevDouble: 5>
        value = 2.0
        w_dim_x = 0
        w_dim_y = 0
        w_dimension = AttributeDimension[
            dim_x = 0
            dim_y = 0
        ]
        w_value = None
    ]
    device = PowerSupply(sys/pstest/1)
    err = False
    errors = ()
    event = "change"
    event_reason = <EventReason.Update: 3>
    reception_date = TimeVal(tv_nsec = 308, tv_sec = 1766504995, tv_usec = 496448)
]

Similar actions in reversed order directly from DServer (I've found that it checks event properties):

  • command ZmqEventSubscriptionChange with argin sys/pstest/1, test, subscribe, change, 6 prints result with pytango=10.1.1
  • shows error for the same argin with pytango=10.0.3

image

Not sure if it's PyTango error, but I've tried to test in on TangoTest device (3.13) with cpptango 10.0.3 and 10.1.1, and subscription failed both times.

Happy holidays 🙂

Assignee Loading
Time tracking Loading