Opened 5 years ago
Last modified 3 years ago
#3326 new bug
Unhandled error in deferred handle_alerts
Reported by: | Patrik Lundquist | 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 by , 5 years ago
Milestone: | needs verified → 2.0.4 |
---|
comment:2 by , 5 years ago
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 very problem but I've had other UnicodeDecodeError problems when loading old torrents.
Directly after upgrade I had to add
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index b94868776..87549215c 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -1389,9 +1390,12 @@ def on_alert_tracker_error(self, alert): error_message = decode_bytes(alert.error_message()) if not error_message: error_message = decode_bytes(alert.error.message()) - log.debug( - 'Tracker Error Alert: %s [%s]', decode_bytes(alert.message()), error_message - ) + try: + log.debug( + 'Tracker Error Alert: %s [%s]', decode_bytes(alert.message()), error_message + ) + except: + pass torrent.set_tracker_status('Error: ' + error_message) def on_alert_storage_moved(self, alert):
so variations on a basic problem perhaps.
Note:
See TracTickets
for help on using tickets.
Can you provide any details on how to replicate this error?