Opened 5 years ago

Closed 4 years ago

#3325 closed bug (Fixed)

Cant remove torrents with 0 download size

Reported by: granjerox Owned by:
Priority: major Milestone: 2.0.4
Component: Core Version:
Keywords: remove delete Cc: deluge-qhqajpof@mpan.pl

Description

When trying to remove non downloading torrents, no matter how added (via file or magnet). I get this error on console:

16:51:03 [ERROR   ][deluge.ui.client                  :169 ] RPCError Message Received!
--------------------------------------------------------------------------------
RPCRequest: core.remove_torrents(['2939a4c2c56580d03b0f9e46b77954d8db045bb1', '41316922455745a997a0e6b7359d0193be3600e0', '5eeaa9881ea8c71240db4465ae90a92d75e39d50', '2804f14263e17255f6a3028c2dada6e61deee2d9'], True)
--------------------------------------------------------------------------------
TypeError
join() argument must be str or bytes, not 'NoneType': Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 347, in on_fail
    failure.raiseException()
  File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 385, in raiseException
    raise self.value.with_traceback(self.tb)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 653, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/internet/task.py", line 865, in <lambda>
    d.addCallback(lambda ignored: callable(*args, **kw))
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 613, in do_remove_torrents
    torrent_id, remove_data=remove_data, save_state=False
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 745, in remove
    torrent.delete_torrentfile(delete_copies)
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1317, in delete_torrentfile
    os.path.join(self.config['torrentfiles_location'], self.filename)
  File "/usr/lib/python3.6/posixpath.py", line 94, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.6/genericpath.py", line 149, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'

--------------------------------------------------------------------------------
Unhandled error in Deferred:
16:51:03 [CRITICAL][twisted                           :154 ] Unhandled error in Deferred:

16:51:03 [CRITICAL][deluge.log                        :93  ] twisted.internet.defer 
[Failure instance: Traceback (failure with no frames): <class 'deluge.error.WrappedException'>: join() argument must be str or bytes, not 'NoneType'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 347, in on_fail
    failure.raiseException()
  File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 385, in raiseException
    raise self.value.with_traceback(self.tb)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 653, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/internet/task.py", line 865, in <lambda>
    d.addCallback(lambda ignored: callable(*args, **kw))
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 613, in do_remove_torrents
    torrent_id, remove_data=remove_data, save_state=False
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 745, in remove
    torrent.delete_torrentfile(delete_copies)
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1317, in delete_torrentfile
    os.path.join(self.config['torrentfiles_location'], self.filename)
  File "/usr/lib/python3.6/posixpath.py", line 94, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.6/genericpath.py", line 149, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'

]

On Ubuntu 18.04

deluge-common  --> 2.0.3-2~201906121747~ubuntu18.04.1 -- Deluge Common Files
deluge-console --> 2.0.3-2~201906121747~ubuntu18.04.1 -- Deluge Console UI
deluge-gtk     --> 2.0.3-2~201906121747~ubuntu18.04.1 -- Deluge GTK UI
deluge-web     --> 2.0.3-2~201906121747~ubuntu18.04.1 -- Deluge Web UI
deluged        --> 2.0.3-2~201906121747~ubuntu18.04.1 -- Deluge Daemon (deluged)

With stable ppa

deb http://ppa.launchpad.net/deluge-team/stable/ubuntu bionic main

Change History (12)

comment:1 by Calum, 5 years ago

Milestone: needs verified2.0.4

comment:2 by bogstriples, 5 years ago

Cc: deluge-qhqajpof@mpan.pl added
Version: 2.0.3

Arch Linux, packages used:

deluge 2.0.4.dev23+g2f1c008a2-3
libtorrent-rasterbar 1:1.2.5-1
python-twisted 19.10.0-3
python 3.8.2-1
python-attrs 19.3.0-4
python-automat 20.2.0-1
python-click 7.1.1-1
python-constantly 15.1.0-5
python-hyperlink 19.0.0-3
python-idna 2.9-1
python-incremental 17.5.0-4
python-pyhamcrest 1.9.0-5
python-six 1.14.0-1
python-zope-interface 5.0.2-1

Log:

--------------------------------------------------------------------------------
RPCRequest: core.remove_torrents(['<CENSORED>'], False)
--------------------------------------------------------------------------------
TypeError
join() argument must be str, bytes, or os.PathLike object, not 'NoneType': Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/deluge/core/rpcserver.py", line 347, in on_fail
    failure.raiseException()
  File "/usr/lib/python3.8/site-packages/twisted/python/failure.py", line 488, in raiseException
    raise self.value.with_traceback(self.tb)
  File "/usr/lib/python3.8/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3.8/site-packages/twisted/internet/task.py", line 866, in <lambda>
    d.addCallback(lambda ignored: callable(*args, **kw))
  File "/usr/lib/python3.8/site-packages/deluge/core/core.py", line 613, in do_remove_torrents
    self.torrentmanager.remove(
  File "/usr/lib/python3.8/site-packages/deluge/core/torrentmanager.py", line 745, in remove
    torrent.delete_torrentfile(delete_copies)
  File "/usr/lib/python3.8/site-packages/deluge/core/torrent.py", line 1321, in delete_torrentfile
    os.path.join(self.config['torrentfiles_location'], self.filename)
  File "/usr/lib/python3.8/posixpath.py", line 90, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.8/genericpath.py", line 152, in _check_arg_types
    raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'

--------------------------------------------------------------------------------
17:38:21.383 [CRITICAL][twisted                                               :154 ] Unhandled error in Deferred:
17:38:21.383 [CRITICAL][deluge.log                                            :93  ] twisted.internet.defer 
[Failure instance: Traceback (failure with no frames): <class 'deluge.error.WrappedException'>: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/deluge/core/rpcserver.py", line 347, in on_fail
    failure.raiseException()
  File "/usr/lib/python3.8/site-packages/twisted/python/failure.py", line 488, in raiseException
    raise self.value.with_traceback(self.tb)
  File "/usr/lib/python3.8/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3.8/site-packages/twisted/internet/task.py", line 866, in <lambda>
    d.addCallback(lambda ignored: callable(*args, **kw))
  File "/usr/lib/python3.8/site-packages/deluge/core/core.py", line 613, in do_remove_torrents
    self.torrentmanager.remove(
  File "/usr/lib/python3.8/site-packages/deluge/core/torrentmanager.py", line 745, in remove
    torrent.delete_torrentfile(delete_copies)
  File "/usr/lib/python3.8/site-packages/deluge/core/torrent.py", line 1321, in delete_torrentfile
    os.path.join(self.config['torrentfiles_location'], self.filename)
  File "/usr/lib/python3.8/posixpath.py", line 90, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.8/genericpath.py", line 152, in _check_arg_types
    raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
Last edited 5 years ago by bogstriples (previous) (diff)

comment:3 by DjLegolas, 4 years ago

I'm unable to reproduce on both windows and ubuntu.

Can you share your core config? Especially the "torrentfiles_location" section?

comment:4 by bogstriples, 4 years ago

{
    "file": 1,
    "format": 1
}{
    "add_paused": false,
    "allow_remote": false,
    "auto_manage_prefer_seeds": false,
    "auto_managed": true,
    "autoadd_enable": false,
    "autoadd_location": "/home/testuser/torrents/import",
    "cache_expiry": 60,
    "cache_size": 384,
    "compact_allocation": false,
    "copy_torrent_file": true,
    "daemon_port": 58846,
    "del_copy_torrent_file": true,
    "dht": true,
    "dont_count_slow_torrents": true,
    "download_location": "/home/testuser/torrents/dl",
    "download_location_paths_list": [],
    "enabled_plugins": [
        "Label",
        "AutoAdd",
        "Blocklist"
    ],
    "enc_in_policy": 1,
    "enc_level": 2,
    "enc_out_policy": 1,
    "enc_prefer_rc4": true,
    "geoip_db_location": "/usr/share/GeoIP/GeoIP.dat",
    "ignore_limits_on_local_network": false,
    "info_sent": 1450224412.77075,
    "listen_interface": "",
    "listen_ports": [
        45412,
        45412
    ],
    "listen_random_port": null,
    "listen_reuse_port": true,
    "listen_use_sys_port": false,
    "lsd": false,
    "max_active_downloading": 9,
    "max_active_limit": 999,
    "max_active_seeding": 999,
    "max_connections_global": 200,
    "max_connections_per_second": 20,
    "max_connections_per_torrent": -1,
    "max_download_speed": -1.0,
    "max_download_speed_per_torrent": -1,
    "max_half_open_connections": 20,
    "max_upload_slots_global": 32,
    "max_upload_slots_per_torrent": -1,
    "max_upload_speed": 3000.0,
    "max_upload_speed_per_torrent": -1,
    "move_completed": true,
    "move_completed_path": "/home/testuser/torrents/finished",
    "move_completed_paths_list": [],
    "natpmp": false,
    "new_release_check": false,
    "outgoing_interface": "",
    "outgoing_ports": [
        0,
        0
    ],
    "path_chooser_accelerator_string": "Tab",
    "path_chooser_auto_complete_enabled": true,
    "path_chooser_max_popup_rows": 20,
    "path_chooser_show_chooser_button_on_localhost": true,
    "path_chooser_show_hidden_files": false,
    "peer_tos": "0x00",
    "plugins_location": "/home/testuser/.config/deluge/plugins",
    "pre_allocate_storage": false,
    "prioritize_first_last_pieces": false,
    "proxy": {
        "anonymous_mode": false,
        "force_proxy": false,
        "hostname": "",
        "password": "",
        "port": 8080,
        "proxy_hostnames": true,
        "proxy_peer_connections": true,
        "proxy_tracker_connections": true,
        "type": 0,
        "username": ""
    },
    "queue_new_to_top": false,
    "random_outgoing_ports": true,
    "random_port": false,
    "rate_limit_ip_overhead": true,
    "remove_seed_at_ratio": false,
    "seed_time_limit": 180,
    "seed_time_ratio_limit": 7.0,
    "send_info": true,
    "sequential_download": false,
    "share_ratio_limit": 5.0,
    "shared": false,
    "stop_seed_at_ratio": true,
    "stop_seed_ratio": 3.0,
    "super_seeding": false,
    "torrentfiles_location": "/home/testuser/torrents/torrents",
    "upnp": false,
    "utpex": true
}

comment:5 by Ghostkeeper, 4 years ago

I'm having the same problem. When running Deluge via a command line the error message is the same. The symptom, at least when deleting a torrent that was added via a magnet, is that the torrent's title is replaced by the hex code of the magnet. Upon the next restart of Deluge, the title is restored again.

This is my core.conf, for comparison:

{
    "file": 1,
    "format": 1
}{
    "add_paused": false,
    "allow_remote": false,
    "auto_manage_prefer_seeds": false,
    "auto_managed": true,
    "cache_expiry": 60,
    "cache_size": 512,
    "copy_torrent_file": true,
    "daemon_port": 58846,
    "del_copy_torrent_file": true,
    "dht": true,
    "dont_count_slow_torrents": false,
    "download_location": "/home/trin/Gedeeld/Torrents",
    "download_location_paths_list": [],
    "enabled_plugins": [],
    "enc_in_policy": 1,
    "enc_level": 2,
    "enc_out_policy": 1,
    "geoip_db_location": "/usr/share/GeoIP/GeoIP.dat",
    "ignore_limits_on_local_network": true,
    "info_sent": 0.0,
    "listen_interface": "",
    "listen_ports": [
        6881,
        6881
    ],
    "listen_random_port": 54560,
    "listen_reuse_port": true,
    "listen_use_sys_port": false,
    "lsd": true,
    "max_active_downloading": 10,
    "max_active_limit": 45,
    "max_active_seeding": 40,
    "max_connections_global": 200,
    "max_connections_per_second": 20,
    "max_connections_per_torrent": -1,
    "max_download_speed": -1.0,
    "max_download_speed_per_torrent": -1,
    "max_half_open_connections": 20,
    "max_upload_slots_global": 30,
    "max_upload_slots_per_torrent": -1,
    "max_upload_speed": -1.0,
    "max_upload_speed_per_torrent": -1,
    "move_completed": false,
    "move_completed_path": "/home/trin/Downloads",
    "move_completed_paths_list": [],
    "natpmp": true,
    "new_release_check": false,
    "outgoing_interface": "",
    "outgoing_ports": [
        0,
        0
    ],
    "path_chooser_accelerator_string": "Tab",
    "path_chooser_auto_complete_enabled": true,
    "path_chooser_max_popup_rows": 20,
    "path_chooser_show_chooser_button_on_localhost": true,
    "path_chooser_show_hidden_files": false,
    "peer_tos": "0x00",
    "plugins_location": "/home/trin/.config/deluge/plugins",
    "pre_allocate_storage": false,
    "prioritize_first_last_pieces": false,
    "proxy": {
        "anonymous_mode": false,
        "force_proxy": false,
        "hostname": "",
        "password": "",
        "port": 8080,
        "proxy_hostnames": true,
        "proxy_peer_connections": true,
        "proxy_tracker_connections": true,
        "type": 0,
        "username": ""
    },
    "queue_new_to_top": false,
    "random_outgoing_ports": true,
    "random_port": true,
    "rate_limit_ip_overhead": true,
    "remove_seed_at_ratio": false,
    "seed_time_limit": 180,
    "seed_time_ratio_limit": 7.0,
    "send_info": false,
    "sequential_download": false,
    "share_ratio_limit": 2.0,
    "shared": false,
    "stop_seed_at_ratio": false,
    "stop_seed_ratio": 2.0,
    "super_seeding": false,
    "torrentfiles_location": "/home/trin/Gedeeld/Torrents",
    "upnp": true,
    "utpex": true
}

No plug-ins have been enabled. As far as I remember, the only things changed in the preferences are that I've customised the download location, and increased the number of connections and queue length. I'm running Ubuntu 20.04.

comment:6 by Alexey, 4 years ago

The same problem on Arch with both master(2.0.3) and develop(2.0.4.dev-38) versions. When trying to remove torrents which are stalled at 0%, they are not being deleted and GTK UI becomes broken(cannot switch between active/downloading/seeding/all categories). After restarting deluge those torrents are still in the list. They can be removed only manually from the state directory.

in reply to:  6 ; comment:7 by bogstriples, 4 years ago

Alexey104: how do you remove them from the state directory? In my case the relevant .torrent files aren’t even present in that directory.

I’ve observed that for the affected downloads I’m also unable to use the “Open Download Folder” option from the context menu in the GUI. Caues:

Unhandled error in Deferred:
20:50:58.961 [CRITICAL][twisted                           :154 ] Unhandled error in Deferred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/deluge/transfer.py", line 129, in _handle_complete_message
    self.message_received(
  File "/usr/lib/python3.8/site-packages/deluge/ui/client.py", line 133, in message_received
    d.callback(request[2])
  File "/usr/lib/python3.8/site-packages/twisted/internet/defer.py", line 460, in callback
    self._startRunCallbacks(result)
  File "/usr/lib/python3.8/site-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/lib/python3.8/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3.8/site-packages/deluge/ui/gtk3/menubar.py", line 318, in _on_torrent_status
    status['download_location'], status['files'][0]['path'].split('/')[0]
builtins.IndexError: tuple index out of range

20:50:58.962 [CRITICAL][deluge.log                        :93  ] twisted.internet.defer 
[Failure instance: Traceback: <class 'IndexError'>: tuple index out of range
/usr/lib/python3.8/site-packages/deluge/transfer.py:129:_handle_complete_message
/usr/lib/python3.8/site-packages/deluge/ui/client.py:133:message_received
/usr/lib/python3.8/site-packages/twisted/internet/defer.py:460:callback
/usr/lib/python3.8/site-packages/twisted/internet/defer.py:568:_startRunCallbacks
--- <exception caught here> ---
/usr/lib/python3.8/site-packages/twisted/internet/defer.py:654:_runCallbacks
/usr/lib/python3.8/site-packages/deluge/ui/gtk3/menubar.py:318:_on_torrent_status

in reply to:  7 comment:8 by Alexey, 4 years ago

Replying to bogstriples:

Alexey104: how do you remove them from the state directory? In my case the relevant .torrent files aren’t even present in that directory.


Yes, you are right, I've just checked and see that I don't have relevant .torrent files in state folder too. I guess stalled torrents are stored in .fastresume files. The thing is, I have another annoying issue when deluge sometimes removes all my torrents from the list after restart. To partially solve that problem I wrote a simple bash script which does a backup of my state directory every hour, so I always have a backup in case if anything goes wrong. When some torrents are stalled at 0% and I cannot remove them, I just remove my state folder and use that backup folder instead, it helps if those stalled torrents had been added before the last backup was done. I think this is because .fastresume files are being overwritten.

I’ve observed that for the affected downloads I’m also unable to use the “Open Download Folder” option from the context menu in the GUI. Caues:...


Confirm.

comment:9 by ridic, 4 years ago

I can confirm that I'm seeing this issue with many instances of 2.0.3 (running on seedboxco.net).

At the moment my only response is to wait for 2.0.4. I'm happy to provide a test platform if you want to confirm the bug?

comment:10 by Mathieu CLAVEL, 4 years ago

I'm having the same problem on deluge 2.0.3-3.

I've added a magnet for a very big file (.torrent file is 21MB, data size > 200GB).

The file was not added correctly and is in error state.

It's on a seedbox and I think the problem is with the filesystem used for the torrent apps because I had a similar problem for the same torrent on rutorrent/rtorrent on the same seedbox.

No data were created on the disk.

When I try to remove the torrent, with or without removing the data, deluge stop working and I have to restart it.

12:03:55 [INFO    ][deluge.core.core              :606 ] Removing 1 torrents from core.
12:03:55 [ERROR   ][deluge.core.eventmanager      :43  ] Event handler PreTorrentRemovedEvent failed in <bound method Core.__on_pre_torrent_removed of <deluge_autoadd.core.Core object at 0x7f2a22fcd9e8>> with exception join() argument must be str or bytes, not 'NoneType'
12:03:55 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 347, in on_fail
    failure.raiseException()
  File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 385, in raiseException
    raise self.value.with_traceback(self.tb)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 653, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/internet/task.py", line 865, in <lambda>
    d.addCallback(lambda ignored: callable(*args, **kw))
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 613, in do_remove_torrents
    torrent_id, remove_data=remove_data, save_state=False
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 745, in remove
    torrent.delete_torrentfile(delete_copies)
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1317, in delete_torrentfile
    os.path.join(self.config['torrentfiles_location'], self.filename)
  File "/usr/lib/python3.6/posixpath.py", line 94, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.6/genericpath.py", line 149, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'

12:03:56 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used

12:03:56 [ERROR   ][deluge.core.rpcserver         :1343] Exception calling RPC request: invalid torrent handle used
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used
12:03:56 [CRITICAL][twisted                       :154 ] Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 122, in run_daemon
    daemon.start()
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 164, in start
    reactor.run()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
    self.mainLoop()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 878, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1596, in on_alert_state_update
    self.handle_torrents_status_callback(self.torrents_status_requests.pop())
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1666, in handle_torrents_status_callback
    torrent_keys, diff, all_keys=not keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
builtins.RuntimeError: invalid torrent handle used

12:03:58 [CRITICAL][twisted                       :154 ] Unhandled error in Deferred:
12:03:58 [CRITICAL][deluge.log                    :93  ] twisted.internet.defer 
[Failure instance: Traceback: <class 'TypeError'>: join() argument must be str or bytes, not 'NoneType'
/usr/lib/python3/dist-packages/twisted/internet/base.py:1252:mainLoop
/usr/lib/python3/dist-packages/twisted/internet/base.py:878:runUntilCurrent
/usr/lib/python3/dist-packages/twisted/internet/defer.py:459:callback
/usr/lib/python3/dist-packages/twisted/internet/defer.py:567:_startRunCallbacks
--- <exception caught here> ---
/usr/lib/python3/dist-packages/twisted/internet/defer.py:653:_runCallbacks
/usr/lib/python3/dist-packages/twisted/internet/task.py:865:<lambda>
/usr/lib/python3/dist-packages/deluge/core/core.py:613:do_remove_torrents
/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py:745:remove
/usr/lib/python3/dist-packages/deluge/core/torrent.py:1317:delete_torrentfile
/usr/lib/python3.6/posixpath.py:94:join
/usr/lib/python3.6/genericpath.py:149:_check_arg_types
]
12:03:58 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used

12:03:58 [ERROR   ][deluge.core.rpcserver         :1343] Exception calling RPC request: invalid torrent handle used
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used
12:03:58 [CRITICAL][twisted                       :154 ] Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 122, in run_daemon
    daemon.start()
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 164, in start
    reactor.run()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
    self.mainLoop()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 878, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1596, in on_alert_state_update
    self.handle_torrents_status_callback(self.torrents_status_requests.pop())
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1666, in handle_torrents_status_callback
    torrent_keys, diff, all_keys=not keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
builtins.RuntimeError: invalid torrent handle used

12:04:00 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used

12:04:00 [ERROR   ][deluge.core.rpcserver         :1343] Exception calling RPC request: invalid torrent handle used
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used
12:04:00 [CRITICAL][twisted                       :154 ] Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 122, in run_daemon
    daemon.start()
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 164, in start
    reactor.run()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
    self.mainLoop()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 878, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1596, in on_alert_state_update
    self.handle_torrents_status_callback(self.torrents_status_requests.pop())
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1666, in handle_torrents_status_callback
    torrent_keys, diff, all_keys=not keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
builtins.RuntimeError: invalid torrent handle used

12:04:02 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used

12:04:02 [ERROR   ][deluge.core.rpcserver         :1343] Exception calling RPC request: invalid torrent handle used
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used
12:04:02 [CRITICAL][twisted                       :154 ] Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 122, in run_daemon
    daemon.start()
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 164, in start
    reactor.run()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
    self.mainLoop()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 878, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1596, in on_alert_state_update
    self.handle_torrents_status_callback(self.torrents_status_requests.pop())
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1666, in handle_torrents_status_callback
    torrent_keys, diff, all_keys=not keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
builtins.RuntimeError: invalid torrent handle used

12:04:04 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used

12:04:04 [ERROR   ][deluge.core.rpcserver         :1343] Exception calling RPC request: invalid torrent handle used
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used
12:04:04 [CRITICAL][twisted                       :154 ] Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 122, in run_daemon
    daemon.start()
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 164, in start
    reactor.run()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
    self.mainLoop()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 878, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1596, in on_alert_state_update
    self.handle_torrents_status_callback(self.torrents_status_requests.pop())
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1666, in handle_torrents_status_callback
    torrent_keys, diff, all_keys=not keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
builtins.RuntimeError: invalid torrent handle used

12:04:06 [CRITICAL][twisted                       :154 ] Unhandled error in Deferred:
12:04:06 [CRITICAL][deluge.log                    :93  ] twisted.internet.defer 
[Failure instance: Traceback: <class 'RuntimeError'>: invalid torrent handle used
/usr/lib/python3/dist-packages/twisted/internet/base.py:1243:run
/usr/lib/python3/dist-packages/twisted/internet/base.py:1252:mainLoop
/usr/lib/python3/dist-packages/twisted/internet/base.py:878:runUntilCurrent
/usr/lib/python3/dist-packages/twisted/internet/task.py:239:__call__
--- <exception caught here> ---
/usr/lib/python3/dist-packages/twisted/internet/defer.py:150:maybeDeferred
/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py:1029:save_resume_data
/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py:1021:<genexpr>
]
12:04:06 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used

12:04:06 [ERROR   ][deluge.core.rpcserver         :1343] Exception calling RPC request: invalid torrent handle used
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used
12:04:06 [CRITICAL][twisted                       :154 ] Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 122, in run_daemon
    daemon.start()
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 164, in start
    reactor.run()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
    self.mainLoop()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 878, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1596, in on_alert_state_update
    self.handle_torrents_status_callback(self.torrents_status_requests.pop())
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1666, in handle_torrents_status_callback
    torrent_keys, diff, all_keys=not keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
builtins.RuntimeError: invalid torrent handle used

12:04:08 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used

12:04:08 [ERROR   ][deluge.core.rpcserver         :1343] Exception calling RPC request: invalid torrent handle used
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used
12:04:08 [CRITICAL][twisted                       :154 ] Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 122, in run_daemon
    daemon.start()
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 164, in start
    reactor.run()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
    self.mainLoop()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 878, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1596, in on_alert_state_update
    self.handle_torrents_status_callback(self.torrents_status_requests.pop())
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1666, in handle_torrents_status_callback
    torrent_keys, diff, all_keys=not keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
builtins.RuntimeError: invalid torrent handle used

12:04:09 [INFO    ][deluge.core.core              :606 ] Removing 1 torrents from core.
12:04:09 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 347, in on_fail
    failure.raiseException()
  File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 385, in raiseException
    raise self.value.with_traceback(self.tb)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 653, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/internet/task.py", line 865, in <lambda>
    d.addCallback(lambda ignored: callable(*args, **kw))
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 613, in do_remove_torrents
    torrent_id, remove_data=remove_data, save_state=False
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 727, in remove
    torrent_name = torrent.get_status(['name'])['name']
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
RuntimeError: invalid torrent handle used

12:04:10 [INFO    ][deluge.core.core              :606 ] Removing 1 torrents from core.
12:04:10 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 347, in on_fail
    failure.raiseException()
  File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 385, in raiseException
    raise self.value.with_traceback(self.tb)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 653, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/internet/task.py", line 865, in <lambda>
    d.addCallback(lambda ignored: callable(*args, **kw))
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 613, in do_remove_torrents
    torrent_id, remove_data=remove_data, save_state=False
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 727, in remove
    torrent_name = torrent.get_status(['name'])['name']
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
RuntimeError: invalid torrent handle used

12:04:10 [INFO    ][deluge.core.core              :606 ] Removing 1 torrents from core.
12:04:10 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 347, in on_fail
    failure.raiseException()
  File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 385, in raiseException
    raise self.value.with_traceback(self.tb)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 653, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/internet/task.py", line 865, in <lambda>
    d.addCallback(lambda ignored: callable(*args, **kw))
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 613, in do_remove_torrents
    torrent_id, remove_data=remove_data, save_state=False
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 727, in remove
    torrent_name = torrent.get_status(['name'])['name']
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
RuntimeError: invalid torrent handle used

12:04:10 [INFO    ][deluge.core.core              :606 ] Removing 1 torrents from core.
12:04:10 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 347, in on_fail
    failure.raiseException()
  File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 385, in raiseException
    raise self.value.with_traceback(self.tb)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 653, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/internet/task.py", line 865, in <lambda>
    d.addCallback(lambda ignored: callable(*args, **kw))
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 613, in do_remove_torrents
    torrent_id, remove_data=remove_data, save_state=False
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 727, in remove
    torrent_name = torrent.get_status(['name'])['name']
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
RuntimeError: invalid torrent handle used

12:04:10 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used

12:04:10 [ERROR   ][deluge.core.rpcserver         :1343] Exception calling RPC request: invalid torrent handle used
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used
12:04:10 [CRITICAL][twisted                       :154 ] Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 122, in run_daemon
    daemon.start()
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 164, in start
    reactor.run()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
    self.mainLoop()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 878, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1596, in on_alert_state_update
    self.handle_torrents_status_callback(self.torrents_status_requests.pop())
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1666, in handle_torrents_status_callback
    torrent_keys, diff, all_keys=not keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
builtins.RuntimeError: invalid torrent handle used

12:04:12 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used

12:04:12 [ERROR   ][deluge.core.rpcserver         :1343] Exception calling RPC request: invalid torrent handle used
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used
12:04:12 [CRITICAL][twisted                       :154 ] Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 122, in run_daemon
    daemon.start()
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 164, in start
    reactor.run()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
    self.mainLoop()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 878, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1596, in on_alert_state_update
    self.handle_torrents_status_callback(self.torrents_status_requests.pop())
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1666, in handle_torrents_status_callback
    torrent_keys, diff, all_keys=not keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
builtins.RuntimeError: invalid torrent handle used

12:04:14 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used

12:04:14 [ERROR   ][deluge.core.rpcserver         :1343] Exception calling RPC request: invalid torrent handle used
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used
12:04:14 [CRITICAL][twisted                       :154 ] Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 122, in run_daemon
    daemon.start()
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 164, in start
    reactor.run()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
    self.mainLoop()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 878, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1596, in on_alert_state_update
    self.handle_torrents_status_callback(self.torrents_status_requests.pop())
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1666, in handle_torrents_status_callback
    torrent_keys, diff, all_keys=not keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
builtins.RuntimeError: invalid torrent handle used

12:04:16 [WARNING ][deluge.core.rpcserver         :242 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used

12:04:16 [ERROR   ][deluge.core.rpcserver         :1343] Exception calling RPC request: invalid torrent handle used
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/rpcserver.py", line 326, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 768, in get_torrent_status
    all_keys=not keys,
  File "/usr/lib/python3/dist-packages/deluge/core/core.py", line 743, in create_torrent_status
    torrent_keys, diff, update=update, all_keys=all_keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 995, in get_status
    self.update_status(self.handle.status())
RuntimeError: invalid torrent handle used
12:04:16 [CRITICAL][twisted                       :154 ] Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 122, in run_daemon
    daemon.start()
  File "/usr/lib/python3/dist-packages/deluge/core/daemon.py", line 164, in start
    reactor.run()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1243, in run
    self.mainLoop()
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1252, in mainLoop
    self.runUntilCurrent()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 878, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1596, in on_alert_state_update
    self.handle_torrents_status_callback(self.torrents_status_requests.pop())
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1666, in handle_torrents_status_callback
    torrent_keys, diff, all_keys=not keys
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 1003, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3/dist-packages/deluge/core/torrent.py", line 938, in get_name
    name = decode_bytes(self.handle.name())
builtins.RuntimeError: invalid torrent handle used

comment:11 by fast9881, 4 years ago

From what i understand the probem is deluge is trying to delete a (magnet) torrent while it still hasn't downloaded or the .torrent is missing. In my case it breaks because i have the 'copy .torrent files to' and 'delete copy of .torrents on remove' options active.

I managed to at least patch it on my system (fedora 32 headless) by adding a simple size check like before it calls for the deletion function

  • deluge/core/torrentmanager.py

    def remove(self, torrent_id, remove_data=False, save_state=True): magnet=None):  
    741741       # Remove the .torrent file in the state and copy location, if user requested.
    742742       delete_copies = (
    743743           self.config['copy_torrent_file'] and self.config['del_copy_torrent_file']
    744744       )
     745       if torrent.get_status(['num_pieces'])['num_pieces'] != 0:
    745746           torrent.delete_torrentfile(delete_copies)

and it seems to work

Last edited 4 years ago by fast9881 (previous) (diff)

comment:12 by Calum, 4 years ago

Resolution: Fixed
Status: newclosed

Finally got around to looking at this, fixed: [da5d5bee209d]

Note: See TracTickets for help on using tickets.