Opened 8 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:


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:

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

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.