Throwing from modpython OnShutdown prevents unload/shutdown of ZNC #956

Open
opened 2026-10-05 04:55:21 +02:00 by adam · 0 comments
Owner

If a python module has a problem where it will raise OnShutdown the module will become unloadable, and subsequently ZNC cannot be shutdown as that will get in a loop trying to unlod the module.

Example module:

import znc

class auth(znc.Module):
    module_types = [znc.CModInfo.GlobalModule]

    def OnShutdown(self):
        # znc.Get() should be `znc.CZNC.Get()` and thus causes exception
        znc.Get().GetUserMap():

Shutdown:

[2020-08-03 19:33:21.181198] modpython: Traceback (most recent call last):\x0A  File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A    module.OnShutdown()\x0A  File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A    for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A
[2020-08-03 19:33:21.181402] modpython: Traceback (most recent call last):\x0A  File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A    module.OnShutdown()\x0A  File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A    for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A
[2020-08-03 19:33:21.181464] modpython: Traceback (most recent call last):\x0A  File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A    module.OnShutdown()\x0A  File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A    for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A
[2020-08-03 19:33:21.181515] modpython: Traceback (most recent call last):\x0A  File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A    module.OnShutdown()\x0A  File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A    for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A
[2020-08-03 19:33:21.181676] modpython: Traceback (most recent call last):\x0A  File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A    module.OnShutdown()\x0A  File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A    for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A
[2020-08-03 19:33:21.181739] modpython: Traceback (most recent call last):\x0A  File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A    module.OnShutdown()\x0A  File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A    for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A
[2020-08-03 19:33:21.181792] modpython: Traceback (most recent call last):\x0A  File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A    module.OnShutdown()\x0A  File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A    for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A
[2020-08-03 19:33:21.181938] modpython: Traceback (most recent call last):\x0A  File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A    module.OnShutdown()\x0A  File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A    for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A
[2020-08-03 19:33:21.181999] modpython: Traceback (most recent call last):\x0A  File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A    module.OnShutdown()\x0A  File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A    for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A
If a python module has a problem where it will raise `OnShutdown` the module will become unloadable, and subsequently ZNC cannot be shutdown as that will get in a loop trying to unlod the module. Example module: ```python import znc class auth(znc.Module): module_types = [znc.CModInfo.GlobalModule] def OnShutdown(self): # znc.Get() should be `znc.CZNC.Get()` and thus causes exception znc.Get().GetUserMap(): ``` Shutdown: ``` [2020-08-03 19:33:21.181198] modpython: Traceback (most recent call last):\x0A File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A module.OnShutdown()\x0A File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A [2020-08-03 19:33:21.181402] modpython: Traceback (most recent call last):\x0A File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A module.OnShutdown()\x0A File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A [2020-08-03 19:33:21.181464] modpython: Traceback (most recent call last):\x0A File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A module.OnShutdown()\x0A File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A [2020-08-03 19:33:21.181515] modpython: Traceback (most recent call last):\x0A File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A module.OnShutdown()\x0A File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A [2020-08-03 19:33:21.181676] modpython: Traceback (most recent call last):\x0A File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A module.OnShutdown()\x0A File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A [2020-08-03 19:33:21.181739] modpython: Traceback (most recent call last):\x0A File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A module.OnShutdown()\x0A File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A [2020-08-03 19:33:21.181792] modpython: Traceback (most recent call last):\x0A File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A module.OnShutdown()\x0A File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A [2020-08-03 19:33:21.181938] modpython: Traceback (most recent call last):\x0A File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A module.OnShutdown()\x0A File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A [2020-08-03 19:33:21.181999] modpython: Traceback (most recent call last):\x0A File "/usr/local/Cellar/znc/1.8.1/lib/znc/modpython/znc.py", line 819, in unload_module\x0A module.OnShutdown()\x0A File "/Users/kyle/.znc/modules/auth.py", line 16, in OnShutdown\x0A for user in znc.CZNC.Get().GetUserMap():\x0AAttributeError: module 'znc' has no attribute 'Get'\x0A ``` <!-- github-sync-id:672296839 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#956