sardana-org / sardana

Moved to GitLab: https://gitlab.com/sardana-org/sardana
39 stars 51 forks source link

Maximum recursion error in spock #1035

Open reszelaz opened 5 years ago

reszelaz commented 5 years ago

Hej,

I also get an error, but directly in spock:


    if self._deviceObj is not None:
  File "/usr/local/lib/python2.7/dist-packages/taurus/core/tango/tangodevice.py", line 74, in __getattr__
    if self._deviceObj is not None:
  File "/usr/local/lib/python2.7/dist-packages/taurus/core/tango/tangodevice.py", line 74, in __getattr__
    if self._deviceObj is not None:
  File "/usr/local/lib/python2.7/dist-packages/taurus/core/tango/tangodevice.py", line 74, in __getattr__
    if self._deviceObj is not None:
  File "/usr/local/lib/python2.7/dist-packages/taurus/core/tango/tangodevice.py", line 74, in __getattr__
    if self._deviceObj is not None:
  File "/usr/local/lib/python2.7/dist-packages/taurus/core/tango/tangodevice.py", line 74, in __getattr__
    if self._deviceObj is not None:
RuntimeError: maximum recursion depth exceeded while calling a Python object

the door output is the following: TaurusTSP.W001 WARNING 2019-01-24 12:29:28,121 tesla.hhg.lab:10000.Pool_xmcd_1: Received elements error event API_EventTimeout: Event channel is not responding anymore, maybe the server or event system is down

is this maybe related?

Best

Daniel

Originally posted by @dschick in https://github.com/sardana-org/sardana/issues/898#issuecomment-457164638

dschick commented 5 years ago

I just got the same error in Spock after a fresh install of Sardana and tango on a VM and running sar_demo.

In our production environment this error occurs not only once, but after its first occurrence it slows down the acquisition dramatically. I guess this is because, I am calling a TaurusDevice within my PseudoCounters quite often.

dschick commented 5 years ago

hej @reszelaz ,

now I am pretty sure, that I get the recursion error in spock only when I am calling self.magnet.getPosition() where self.magnet = taurus.Device("kepco") which is defined in the init method of a pseudocounter.

The whole pseudocounter has the taurus extentions registered.

Finally this makes my acquisition then slow, because I am calling the PC serveral times and habe multiple of them defined.

reszelaz commented 5 years ago

Due to the fact that spock and Pool (or eventually Sardana) are separate processes I do not relate directly the maximum recursion error that you see in spock output as a consecuence of using taurus extensions in your pseudo counters.

But it could be that the use of the extensions finally causes the slowness that you observe. Certainly this is something that I was not aware. Is it that it is slow always, or something triggers it? Does it bocome slower always after the maximum recursion error in spock?

reszelaz commented 5 years ago

Since you comment that in your environment it is much more reproducible could you please run taurus with the following patch. This should avoid the maximum recursion error and report a normal AttributeError. If you rerpduce it with this patch please post here the traceback.

dschick commented 5 years ago

Does it bocome slower always after the maximum recursion error in spock?

yep that is the behaviour. Right now I did a workaround in which I am not calling the TaurusDevice anymore. I use a dedicated TangoDS instead. I will try to reproduce the error first in a develop environment and then I will try it with the patch as well.

Thanks in advance

dschick commented 5 years ago

I am currently running scans in a VM using sar_demo setup but with my pseudo_counter included which pulls a TaurusDevice at every acquisition.

Till now the error was not reproduced. I might try it again with my real setup and see if it reproduces there first, before applying the patch.

reszelaz commented 5 years ago

I run the latest taurus develop branch which now avoids the maximum recussion erros and as a fallback leads to the AttributeError. When closing spock, while the Sardana server was already shutdown I experience this issue:

Door_sep2_1 [33]: exit
MainThread     INFO     2019-02-22 10:50:54,537 TaurusRootLogger: 
*********************
< Deprecation Counts (1716):
        1164 * "_get_value is deprecated since 4.0. Use .rvalue instead"
        387 * "getHWObj is deprecated since 4.0. Use getDeviceProxy() instead"
        82 * "getState is deprecated since 4.0. Use .stateObj.read().rvalue [Tango] or .state [agnostic] instead"
        82 * "getSWState is deprecated since 4.0. Use state instead"
        1 * "getStateObj is deprecated since 4.0. Use .stateObj [Tango] or .factory.getAttribute(state_full_name) [agnostic] instead" >
Dummy-1180     ERROR    2019-02-22 10:50:54,695 root: Invalid alias: The name mv can't be aliased because it is another magic command.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/zreszela/workspace/taurus/lib/taurus/core/tango/tangofactory.py", line 146, in cleanUp
    v.cleanUp()
  File "/home/zreszela/workspace/taurus/lib/taurus/core/tango/tangodevice.py", line 197, in cleanUp
    if not self._deviceStateObj is None:
  File "/home/zreszela/workspace/taurus/lib/taurus/core/tango/tangodevice.py", line 78, in __getattr__
    if self._deviceObj is not None:
  File "/home/zreszela/workspace/taurus/lib/taurus/core/tango/tangodevice.py", line 81, in __getattr__
    raise AttributeError("'%s' has no attribute '%s'" % (cls_name, name))
AttributeError: 'TangoDevice' has no attribute '_deviceObj'
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/zreszela/workspace/taurus/lib/taurus/core/tango/tangofactory.py", line 146, in cleanUp
    v.cleanUp()
  File "/home/zreszela/workspace/taurus/lib/taurus/core/tango/tangodevice.py", line 197, in cleanUp
    if not self._deviceStateObj is None:
  File "/home/zreszela/workspace/taurus/lib/taurus/core/tango/tangodevice.py", line 78, in __getattr__
    if self._deviceObj is not None:
  File "/home/zreszela/workspace/taurus/lib/taurus/core/tango/tangodevice.py", line 81, in __getattr__
    raise AttributeError("'%s' has no attribute '%s'" % (cls_name, name))
AttributeError: 'TangoDevice' has no attribute '_deviceObj'