Skip to content
Snippets Groups Projects

L2SS-1987: Add test to check for race condition between push_change_event and Tango's polling loop

Merged L2SS-1987: Add test to check for race condition between push_change_event and Tango's polling loop
Merged Jan David Mol requested to merge L2SS-1987 into master
Files
8
@@ -62,5 +62,18 @@ class ChangeEvents:
# self.device.push_change_event(attr_name, value, time.now(), AttrQuality.ATTR_INVALID, 0, 0)
return
if (
self.device.is_attribute_polled(attr_name)
and self.device.get_attribute_poll_period(attr_name) > 0
):
# Emitting an event now can cause a segfault in devices using the Asyncio green mode,
# if the Tango polling thread is accessing the same attribute we push an event for.
#
# See https://gitlab.com/tango-controls/cppTango/-/merge_requests/1316
# and https://gitlab.com/tango-controls/pytango/-/merge_requests/729
raise RuntimeError(
f"Cannot send change event for attribute {attr_name} of device {self.device} as it is already polled by Tango. Calling push_change_event can cause a Segmentation Fault."
)
# emit any change
self.device.push_change_event(attr_name, value)
Loading