#3326: Unhandled error in deferred handle_alerts
----------------------------+-------------------
 Reporter:  pLurium         |       Type:  bug
   Status:  new             |   Priority:  major
Milestone:  needs verified  |  Component:  Core
  Version:  2.0.3           |   Keywords:
----------------------------+-------------------
 {{{
 [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:
 {{{#!python
 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"""
 }}}

--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3326>
Deluge <https://deluge-torrent.org/>
Deluge Project

-- 
You received this message because you are subscribed to the Google Groups 
"Deluge Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/deluge-dev/046.71c9d2340e187d57f0fd855a466fb7ab%40deluge-torrent.org.

Reply via email to