Closed reszelaz closed 4 years ago
One could also try to play manually with GC. Something like:
gc.collect()
before we subscribe to events. This way we will ensure that there are no pending unsubscribes to be done.(I have not tried neither of them)
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.
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
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 thetangoattribute._empty_unsub_queue()
could be called more frequently.