Opened 14 years ago

Closed 9 years ago

Last modified 6 years ago

#1530 closed patch (Fixed)

Event handling fails for plugin "AutoAdd" on pref dialog close. (Disconnect on preferences dialog submit)

Reported by: idefixx Owned by:
Priority: minor Milestone: 2.0.0
Component: Core Version: master
Keywords: Cc:

Description

Using deluged and deluge-gtk both 98ca371b15596a2d9ffe120ddb1ed47e62583da2 on "Ubuntu 10.10"

This happens when you open and close the prefs dialog while connected to deluged and the "AutoAdd" plugin is enabled. It seems the event "AutoaddOptionsChangedEvent" isn't registered properly.

04:22:00.457 [deluge.ui.gtkui.preferences        :813 ][DEBUG   ] on_button_ok_clicked
04:22:00.458 [deluge.ui.gtkui.pluginmanager      :113 ][DEBUG   ] run_on_apply_prefs
04:22:00.459 [deluge.plugin.autoadd.gtkui        :330 ][DEBUG   ] applying prefs for AutoAdd
04:22:00.486 [twisted                            :508 ][INFO    ] Error In <<class 'twisted.internet.tcp.TLSConnection'> to ('127.0.0.1', 58847) at 97cedcc>
04:22:00.538 [twisted                            :508 ][ERROR   ] Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/twisted/python/log.py", line 84, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python2.6/dist-packages/twisted/python/log.py", line 69, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python2.6/dist-packages/twisted/python/context.py", line 59, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.6/dist-packages/twisted/python/context.py", line 37, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/usr/lib/python2.6/dist-packages/twisted/internet/gtk2reactor.py", line 288, in _doReadOrWrite
    why = source.doRead()
  File "/usr/lib/python2.6/dist-packages/twisted/internet/tcp.py", line 137, in doRead
    return Connection.doRead(self)
  File "/usr/lib/python2.6/dist-packages/twisted/internet/tcp.py", line 460, in doRead
    return self.protocol.dataReceived(data)
  File "/home/<uname>/lib/python/deluge-1.3.900_dev-py2.6.egg/deluge/ui/client.py", line 174, in dataReceived
    event = known_events[event_name](*request[2])
exceptions.KeyError: 'AutoaddOptionsChangedEvent'

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/twisted/python/log.py", line 84, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/usr/lib/python2.6/dist-packages/twisted/python/log.py", line 69, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
  File "/usr/lib/python2.6/dist-packages/twisted/python/context.py", line 59, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python2.6/dist-packages/twisted/python/context.py", line 37, in callWithContext
    return func(*args,**kw)
--- <exception caught here> ---
  File "/usr/lib/python2.6/dist-packages/twisted/internet/gtk2reactor.py", line 288, in _doReadOrWrite
    why = source.doRead()
  File "/usr/lib/python2.6/dist-packages/twisted/internet/tcp.py", line 137, in doRead
    return Connection.doRead(self)
  File "/usr/lib/python2.6/dist-packages/twisted/internet/tcp.py", line 460, in doRead
    return self.protocol.dataReceived(data)
  File "/home/<uname>/lib/python/deluge-1.3.900_dev-py2.6.egg/deluge/ui/client.py", line 174, in dataReceived
    event = known_events[event_name](*request[2])
exceptions.KeyError: 'AutoaddOptionsChangedEvent'
04:22:00.540 [deluge.ui.client                   :232 ][INFO    ] Connection lost to daemon at 127.0.0.1:58847 reason: 'AutoaddOptionsChangedEvent'
04:22:00.545 [deluge.component                   :235 ][DEBUG   ] Deregistering Component: GtkPlugin.AutoAdd
04:22:00.545 [deluge.pluginmanagerbase           :163 ][INFO    ] Plugin AutoAdd disabled..

Change History (6)

comment:1 by Calum, 14 years ago

Milestone: Future1.4.0
Version: other (please specify)1.3.0_dev

comment:2 by idefixx, 14 years ago

Summary: Event handling fails for plugin "AutoAdd" on pref dialog close.Event handling fails for plugin "AutoAdd" on pref dialog close. (Disconnect on preferences dialog submit)

This was bugging me to no end since it disconnects the gtk-ui every time you you click OK on the prefs dialog or you make any plugin change. This fix seems to work I'm really not sure about it though.

Afaics plugins don't even attempt to register them selfs with deluge.event. Yet DelugeRPCProtocol tries to get keyword arguments from deluge.event for every event it receives, which fails at least for the AutoAdd. No idea what you guys are planing here, since you obviously didn't merge this event stuff into 1.3. Well here is a temp fix patch.

index 9852b29..3e11302 100644
--- a/deluge/ui/client.py
+++ b/deluge/ui/client.py
@@ -171,9 +171,17 @@ def dataReceived(self, data):
                 # A RPCEvent was received from the daemon so run any handlers
                 # associated with it.
                 if event_name in self.factory.event_handlers:
-                    event = known_events[event_name](*request[2])
+                    # Check for keywords arguments
+                    try:
+                        event = known_events[event_name](*request[2])
+                    except:
+                        event = None
                     for handler in self.factory.event_handlers[event_name]:
-                        reactor.callLater(0, handler, event.copy())
+                        if event == None:
+                            # Twisted doesnt seem to have any problems with this.
+                            reactor.callLater(0, handler, None)
+                        else:
+                            reactor.callLater(0, handler, event.copy())
                 continue

             request_id = request[1]

comment:3 by Calum, 13 years ago

Component: plugincore
Type: bugpatch
Version: 1.3.0_devgit master

comment:4 by Calum, 10 years ago

Milestone: 1.4.02.0.0

comment:5 by Calum, 9 years ago

Resolution: Fixed
Status: newclosed

For reference this was fixed by andar: [499a58f50df649be997f]

comment:6 by Calum, 6 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.