taurus-org / taurus

Moved to https://gitlab.com/taurus-org/taurus
http://taurus-scada.org
43 stars 46 forks source link

WIP: Usubscribe from events on the next subscription (PyTango#292) #1095

Closed reszelaz closed 4 years ago

reszelaz commented 4 years ago

Similarly to #1091 and #1093, this PR tries to workaround https://github.com/tango-controls/pytango/issues/292.

I tried this PR with sardana-org/sardana#1312 ( which reverts the Sardana workaround and use zombie concept in tests) and it works corrrectly for the sardanatestsuite and for the stress macro posted in https://github.com/taurus-org/taurus/pull/1093#issuecomment-602042643. So, IMO it is a satisfactory workaround.

Note that it has one side effect - it keeps garbage collected attributes subscribed until some new attribute is subscribed. To mitigate this effect attributes are marked as zombies - their push event return immediately. Also this should happen only for the configuration events - the change events should be unsubscribed with the last TaurusModel.removeListener call. Also if one wants to increase the frequency of unsubscribes the tangoattribute._empty_unsub_queue() could be called more frequently.

reszelaz commented 4 years ago

One could also try to play manually with GC. Something like:

(I have not tried neither of them)

reszelaz commented 4 years ago

The root issue was solved in https://github.com/tango-controls/cppTango/pull/699. It is available starting from cppTango 9.3.4rc5. Hence I do not foresee to work anymore on this PR.

cpascual commented 4 years ago

Thanks @reszelaz for taking care of this, and sorry for not having been as responsive as I should (I have been busy in other fronts).

One thing that remains to do is using the cppTango >= 9.3.4rc5 in our CI. This could be one way to try to fix #1042