UnicodeDecodeError on Deluge 2.0.3

General support for problems installing or using Deluge
Post Reply
Henshin
New User
New User
Posts: 9
Joined: Thu Nov 12, 2015 9:41 pm

UnicodeDecodeError on Deluge 2.0.3

Post by Henshin »

I've been having a few problems recently with Deluge. Not sure what is the source of the problem yet but I've came across this error on my log:

Code: Select all

23:42:02 [INFO    ][deluge.core.torrentmanager    :768 ] Torrent Torrent.Name.Here removed by user: localclient
23:42:11 [INFO    ][deluge.core.torrentmanager    :672 ] Torrent Torrent.Name.Here from user "localclient" added
23:48:32 [CRITICAL][twisted                       :154 ] Unhandled error in Deferred:
23:48:32 [CRITICAL][deluge.log                    :93  ] twisted.internet.defer 
[Failure instance: Traceback: <class 'UnicodeDecodeError'>: 'utf-8' codec can't decode byte 0xe3 in position 11: invalid continuation byte
/usr/local/lib/python3.6/dist-packages/twisted/internet/base.py:1272:run
/usr/local/lib/python3.6/dist-packages/twisted/internet/base.py:1281:mainLoop
/usr/local/lib/python3.6/dist-packages/twisted/internet/base.py:902:runUntilCurrent
/usr/local/lib/python3.6/dist-packages/twisted/internet/task.py:239:__call__
--- <exception caught here> ---
/usr/local/lib/python3.6/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>
]
To give you a bit of context, this was a torrent which I already downloaded before, so when I added the torrent to Deluge it started to do the normal checking to see if there was anything missing. Same behaviour when I do the "Force recheck".
I don't know where did this invalid byte came from but after this the deluged service crashes and I have to restart it.
This seems to happen with a few torrents I tried but some other work fine, haven't figured out the pattern.
My versions:

Code: Select all

deluged 2.0.3-2-201906121747-ubuntu18.04.1
libtorrent: 1.1.5.0
Python: 3.6.8
OS: Linux 3.10.23-xxxx-std-ipv6-64
Let me know if you need any other info.
Henshin
New User
New User
Posts: 9
Joined: Thu Nov 12, 2015 9:41 pm

Re: UnicodeDecodeError on Deluge 2.0.3

Post by Henshin »

Since there was no reponse to this thread for a long time and I'm still having this issue with some torrents, I've decided to "fix" the code myself by wrapping it with a try catch as such:

Code: Select all

                    # Copy alert attributesa
                    try:
                        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 Exception as e:
                        log.error("Error catched:",e)
So at least now, my Deluge is not crashing when a torrent with strange characters in the filenames are added.
Post Reply