Opened 4 years ago

Last modified 2 years ago

#3326 new bug

Unhandled error in deferred handle_alerts

Reported by: pLurium Owned by:
Priority: major Milestone: 2.0.6
Component: Core Version: 2.0.3
Keywords: Cc:

Description

[CRITICAL][twisted                       :154 ] Unhandled error in Deferred:
[CRITICAL][deluge.log                    :93  ] twisted.internet.defer
[Failure instance: Traceback: <class 'UnicodeDecodeError'>: 'utf-8' codec can't decode byte 0xce in position 0: invalid continuation byte
/usr/local/lib/python3.7/dist-packages/twisted/internet/base.py:1283:run
/usr/local/lib/python3.7/dist-packages/twisted/internet/base.py:1292:mainLoop
/usr/local/lib/python3.7/dist-packages/twisted/internet/base.py:913:runUntilCurrent
/usr/local/lib/python3.7/dist-packages/twisted/internet/task.py:239:__call__
--- <exception caught here> ---
/usr/local/lib/python3.7/dist-packages/twisted/internet/defer.py:151:maybeDeferred
/usr/lib/python3/dist-packages/deluge/core/alertmanager.py:70:update
/usr/lib/python3/dist-packages/deluge/core/alertmanager.py:140:handle_alerts
/usr/lib/python3/dist-packages/deluge/core/alertmanager.py:141:<dictcomp>

Deluge doesn't completely crash but at least stops updating the user interfaces.

A simple workaround for now is catching the exception:

diff --git a/deluge/core/alertmanager.py b/deluge/core/alertmanager.py
index 2fe42224d..fedc48322 100644
--- a/deluge/core/alertmanager.py
+++ b/deluge/core/alertmanager.py
@@ -131,17 +131,20 @@ def handle_alerts(self):
             # Call any handlers for this alert type
             if alert_type in self.handlers:
                 for handler in self.handlers[alert_type]:
-                    if log.isEnabledFor(logging.DEBUG):
-                        log.debug('Handling alert: %s', alert_type)
-                    # Copy alert attributes
-                    alert_copy = SimpleNamespace(
-                        **{
-                            attr: getattr(alert, attr)
-                            for attr in dir(alert)
-                            if not attr.startswith('__')
-                        }
-                    )
-                    self.delayed_calls.append(reactor.callLater(0, handler, alert_copy))
+                    try:
+                        if log.isEnabledFor(logging.DEBUG):
+                            log.debug('Handling alert: %s', alert_type)
+                        # Copy alert attributes
+                        alert_copy = SimpleNamespace(
+                            **{
+                                attr: getattr(alert, attr)
+                                for attr in dir(alert)
+                                if not attr.startswith('__')
+                            }
+                        )
+                        self.delayed_calls.append(reactor.callLater(0, handler, alert_copy))
+                    except:
+                        pass
 
     def set_alert_queue_size(self, queue_size):
         """Sets the maximum size of the libtorrent alert queue"""

Change History (4)

comment:1 Changed 4 years ago by Cas

  • Milestone changed from needs verified to 2.0.4

Can you provide any details on how to replicate this error?

comment:2 Changed 4 years ago by pLurium

I had lots of

[WARNING ][deluge.core.torrentmanager    :1624] on_alert_performance: SomeTörrentNäme: performance warning: max outstanding piece requests reached, outstanding_request_limit_reached

and I think the name in one of them triggered the UnicodeDecodeError. I've upgraded earlier from Deluge 1.3 but didn't immediately run into this.

Version 0, edited 4 years ago by pLurium (next)

comment:3 Changed 2 years ago by Cas

  • Milestone changed from 2.0.4 to 2.0.5

Ticket retargeted after milestone closed

comment:4 Changed 2 years ago by Cas

  • Milestone changed from 2.0.5 to 2.0.6

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.