Opened 7 years ago

Last modified 7 years ago

#2930 new bug

Potential issue with using inspect in log.get_plugin_logger

Reported by: Cas Owned by:
Priority: major Milestone: 2.x
Component: Core Version: develop
Keywords: Cc:

Description

When using a third-party plugin such as Autoshutdown in this trace below and it seems to be due to the use of inspect.stack() which can potentially crash on shutdown. This is legacy plugin logging code but if it crashes deluge then it is no good releasing it.

There is a good SO question with alternatives to using inspect: http://stackoverflow.com/q/5067604/175584

[ERROR   ][deluge.pluginmanagerbase           :215 ] Error when disabling plugin 'AutoShutdown'
[ERROR   ][deluge.pluginmanagerbase           :1200] Traceback (most recent call last):
  File "deluge/core/pluginmanager.py", line 43, in stop
    self.disable_plugins()
  File "deluge/pluginmanagerbase.py", line 79, in disable_plugins
    self.disable_plugin(key)
  File "deluge/core/pluginmanager.py", line 72, in disable_plugin
    d = deluge.pluginmanagerbase.PluginManagerBase.disable_plugin(self, name)
  File "deluge/pluginmanagerbase.py", line 206, in disable_plugin
    d = defer.maybeDeferred(self.plugins[name].disable)
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File "deluge/plugins/init.py", line 28, in disable
    return self.plugin.disable()
  File "build/bdist.linux-x86_64/egg/autoshutdown/core.py", line 111, in disable
    
  File "deluge/log.py", line 286, in __getattribute__
    stack = inspect.stack()
  File "/usr/lib/python2.7/inspect.py", line 1060, in stack
    return getouterframes(sys._getframe(1), context)
  File "/usr/lib/python2.7/inspect.py", line 1038, in getouterframes
    framelist.append((frame,) + getframeinfo(frame, context))
  File "/usr/lib/python2.7/inspect.py", line 1013, in getframeinfo
    lines, lnum = findsource(frame)
  File "/usr/lib/python2.7/inspect.py", line 580, in findsource
    if pat.match(lines[lnum]): break
exceptions.IndexError: list index out of range
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1128, in _inlineCallbacks
    result = g.send(result)
StopIteration

Change History (1)

comment:1 Changed 7 years ago by Cas

  • Milestone changed from 2.0 to 2.x
Note: See TracTickets for help on using tickets.