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 in worker thread (PyTango#292) #1093

Closed reszelaz closed 4 years ago

reszelaz commented 4 years ago

Similarly to https://github.com/taurus-org/taurus/pull/1091, this PR tries to workaround PyTango#292. This one implements the 3.b option proposed by @schooft in https://github.com/tango-controls/pytango/issues/292#issuecomment-585652804. Thanks!

I tried this PR with https://github.com/sardana-org/sardana/pull/1312 ( which reverts the Sardana workaround and use zombie concept in tests) and it worked for 7 testsuite executions already. Note that the usage of zombie API in tests most probably won't be need if we implement https://github.com/taurus-org/taurus/issues/1092.

cpascual commented 4 years ago

This is making 2 tests to fail:

reszelaz commented 4 years ago

This is making 2 tests to fail:

  • test_cleanup_after_polling
  • test_cleanup_state_after_polling

These most probably fail cause I commented the disabling of polling in TangoAttribute._finalUnsubscribeChangeEvents which was not clear to me that it had to be done exactly there. Why not in TangoAttribute.cleanUp?

reszelaz commented 4 years ago

Anyway I have tested it with a typical macro which discovered PyTango#292:

import taurus
from sardana.macroserver.macro import macro

@macro()
def test_dev_gc(self):
    pool = self.door.get_pools()[0]
    moveables = []
    moveables.extend(pool.getElementNamesOfType("motor"))
    moveables.extend(pool.getElementNamesOfType("pseudomotor"))
    channels = []
    channels.extend(pool.getElementNamesOfType("ctexpchannel"))
    channels.extend(pool.getElementNamesOfType("zerodexpchannel"))
    channels.extend(pool.getElementNamesOfType("onedexpchannel"))
    for m in moveables:
        self.print("{}: {}".format(m, taurus.Device(m).getPosition()))
    for ch in channels:
        self.print("{}: {}".format(ch, taurus.Device(ch).getValue()))

And this fails. So 7 consecutive executions of the sardanatestsuite is not an indicator that this workaround works. The above macro is a better way to check it.

So, while executing the macro, the MacroServer hanged with: work_th_bt.txt and work_th_py-bt.txt.

reszelaz commented 4 years ago

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