openatv / enigma2

openatv-gui
GNU General Public License v2.0
200 stars 316 forks source link

Unitialized Screen attributes cause Enigma restart #2274

Closed hroemer closed 2 years ago

hroemer commented 2 years ago

I am having issues under OpenATV 7.0 / 7.1 because certain attributes are not initialized before access:

openATV Enigma2 crash log

crashdate=So Apr 24 09:04:55 2022
compiledate=Apr 22 2022
skin=MadMax/skin.xml
sourcedate=2022-04-22
branch=7.0
rev=2.8.0-24278-g1862652
component=Enigma2

stbmodel=sf8008
stbmodel=dm8000
kernelcmdline=console=ttyAMA0,115200 root=/dev/mmcblk0p16 rootsubdir=linuxrootfs2 rootfstype=ext4 kernel=/dev/mmcblk0p13 userdataroot=/dev/mmcblk0p16 userdatasubdir=userdata2 blkdevparts=mmcblk0:1M(boot),1M(bootargs),1M(bootoptions),3M(baseparam),4M(pqparam),4M(logo),4M(deviceinfo),4M(softwareinfo),4M(loaderdb),32M(loader),8M(trustedcore),16M(linuxkernel1),16M(linuxkernel2),16M(linuxkernel3),16M(linuxkernel4),-(userdata) coherent_pool=2M mem=1G mmz=ddr,0,0,72M vmalloc=500M MACHINEBUILD=sf8008 OEM=octagon MODEL=sf8008
nimsockets=NIM Socket 0:
imageversion=box_type=sf8008
imageissue=Welcome to openATV for %h

08:59:43.0242 [Enigma] Python path is '/usr/lib/enigma2/python'.
08:59:43.0244 [Enigma] DVB API version 5, DVB API version minor 11.
08:59:43.0244 [Enigma] Enigma debug level 3.
08:59:43.8048 [eDVBFrontend] Slow ioctl 'FE_GET_PROPERTY(DTV_API_VERSION)', potential driver issue, 500ms
08:59:44.3518 [eDVBFrontend] Slow ioctl 'FE_GET_PROPERTY(DTV_API_VERSION)', potential driver issue, 500ms
09:00:20.1634 [eDVBPESReader] Created. Opening demux
09:00:20.1636 [eDVBPESReader] Created. Opening demux
09:04:30.3610 Traceback (most recent call last):
09:04:30.3611   File "/usr/lib/enigma2/python/Components/ActionMap.py", line 256, in action
09:04:30.3616   File "/usr/lib/enigma2/python/Components/ActionMap.py", line 238, in action
09:04:30.3619   File "/usr/lib/enigma2/python/Screens/Menu.py", line 362, in okbuttonClick
09:04:30.3623   File "/usr/lib/enigma2/python/Tools/BoundFunction.py", line 10, in __call__
09:04:30.3626   File "/usr/lib/enigma2/python/Screens/Menu.py", line 375, in runScreen
09:04:30.3628   File "/usr/lib/enigma2/python/Screens/Menu.py", line 386, in openDialog
09:04:30.3631   File "/usr/lib/enigma2/python/StartEnigma.py", line 153, in openWithCallback
09:04:30.3638     dialog = self.open(screen, *arguments, **kwargs)
09:04:30.3639   File "/usr/lib/enigma2/python/StartEnigma.py", line 173, in open
09:04:30.3645     self.execBegin()
09:04:30.3645   File "/usr/lib/enigma2/python/StartEnigma.py", line 85, in execBegin
09:04:30.3649     self.instantiateSummaryDialog(currentDialog)
09:04:30.3649   File "/usr/lib/enigma2/python/StartEnigma.py", line 121, in instantiateSummaryDialog
09:04:30.3653     self.summary.show()
09:04:30.3653   File "/usr/lib/enigma2/python/Screens/Screen.py", line 128, in show
09:04:30.3658   File "/usr/lib/enigma2/python/Screens/TimerEdit.py", line 641, in addWatcher
09:04:30.3661   File "/usr/lib/enigma2/python/Screens/TimerEdit.py", line 225, in updateState
09:04:30.3665 UnboundLocalError: local variable 'state' referenced before assignment
09:04:30.3666 [ePyObject] (PyObject_CallObject(<bound method NumberActionMap.action of <Components.ActionMap.HelpableNumberActionMap object at 0xa919f208>>,('OkCancelActions', 'ok')) failed)
09:04:40.3954 Traceback (most recent call last):
09:04:40.3955   File "/usr/lib/enigma2/python/Screens/InfoBarGenerics.py", line 5268, in checkBsodCallback
09:04:40.3959   File "/usr/lib/enigma2/python/StartEnigma.py", line 153, in openWithCallback
09:04:40.3965     dialog = self.open(screen, *arguments, **kwargs)
09:04:40.3965   File "/usr/lib/enigma2/python/StartEnigma.py", line 161, in open
09:04:40.3970     self.pushCurrent()
09:04:40.3971   File "/usr/lib/enigma2/python/StartEnigma.py", line 136, in pushCurrent
09:04:40.3979     self.execEnd(last=False)
09:04:40.3979   File "/usr/lib/enigma2/python/StartEnigma.py", line 95, in execEnd
09:04:40.3984     self.current_dialog.execEnd()
09:04:40.3985   File "/usr/lib/enigma2/python/Screens/Screen.py", line 84, in execEnd
09:04:40.3993 AttributeError: 'TimerEditList' object has no attribute 'active_components'
09:04:40.3994 [ePyObject] (PyObject_CallObject(<bound method InfoBarHandleBsod.checkBsodCallback of <class 'Screens.InfoBar.InfoBar'>>,()) failed)
09:04:41.4156 [eDVBPESReader] ERROR reading PES (fd=78): Function not implemented
09:04:45.3959 Traceback (most recent call last):
09:04:45.3960   File "/usr/lib/enigma2/python/Screens/InfoBarGenerics.py", line 5268, in checkBsodCallback
09:04:45.3964   File "/usr/lib/enigma2/python/StartEnigma.py", line 153, in openWithCallback
09:04:45.3971     dialog = self.open(screen, *arguments, **kwargs)
09:04:45.3971   File "/usr/lib/enigma2/python/StartEnigma.py", line 160, in open
09:04:45.3976     raise RuntimeError("[StartEnigma] Error: Modal open are allowed only from a screen which is modal!")  # ...unless it's the very first screen.
09:04:45.3976 RuntimeError: [StartEnigma] Error: Modal open are allowed only from a screen which is modal!
09:04:45.3977 [ePyObject] (PyObject_CallObject(<bound method InfoBarHandleBsod.checkBsodCallback of <class 'Screens.InfoBar.InfoBar'>>,()) failed)
09:04:55.4068 [eDVBPESReader] ERROR reading PES (fd=78): Function not implemented
09:04:55.4275 Traceback (most recent call last):
09:04:55.4276   File "/usr/lib/enigma2/python/Screens/InfoBarGenerics.py", line 5268, in checkBsodCallback
09:04:55.4280   File "/usr/lib/enigma2/python/StartEnigma.py", line 153, in openWithCallback
09:04:55.4286     dialog = self.open(screen, *arguments, **kwargs)
09:04:55.4286   File "/usr/lib/enigma2/python/StartEnigma.py", line 160, in open
09:04:55.4293     raise RuntimeError("[StartEnigma] Error: Modal open are allowed only from a screen which is modal!")  # ...unless it's the very first screen.
09:04:55.4294 RuntimeError: [StartEnigma] Error: Modal open are allowed only from a screen which is modal!
09:04:55.4294 [ePyObject] (PyObject_CallObject(<bound method InfoBarHandleBsod.checkBsodCallback of <class 'Screens.InfoBar.InfoBar'>>,()) failed)

Adding default values for self.active_components, self.additionalWidgets, self.skinAttributes, self.scale, inside Screen.__init__() should cope with that:

class Screen(dict):
    NO_SUSPEND, SUSPEND_STOPS, SUSPEND_PAUSES = list(range(3))
    ALLOW_SUSPEND = NO_SUSPEND
    globalScreen = None

    def __init__(self, session, parent=None, mandatoryWidgets=None):
        dict.__init__(self)
        self.skinName = self.__class__.__name__
...
        self.active_components = []
        self.additionalWidgets = []
        self.skinAttributes = []
        self.scale = ((1, 1), (1, 1))
...
jbleyel commented 2 years ago

UnboundLocalError: local variable 'state' referenced before assignment

is fixed here -> https://github.com/openatv/enigma2/commit/07307a862dfac60fc8267adc8a12f758dbdf1501

hroemer commented 2 years ago

@jbleyel: thanks for the quick response. Sorry, I didn't pick the top most stack frame and was distracted from indexer accesses before realizing Screens dict inheritance.