Skip to content

[BUG] Cleanuparr keeps crashing Deluge 2.2.0 - "invalid torrent handle used" #281

@bentrop

Description

@bentrop

Before submitting a bug report, I have:

  • Reviewed the documentation.
  • Ensured I am using ghcr.io/cleanuparr/cleanuparr docker repository.
  • Ensured I am using the latest version.
  • Enabled verbose logging.

What is the behavior?

This didn't use to be a problem with Cleanuperr/v1.x

Ever since upgrading to v2.x Cleanuparr frequently leaves my Deluge container in a nonfunctional state. I'm exclusively using Cleanuparr's Malware Blocker and no other features.

I'm leaving Deluge's, far more relevant, log output below, not Cleanuparr's, which looks entirely uneventful/harmless.

"invalid torrent handle used" usually indicates that Deluge is trying to interact with a torrent that no longer has a valid libtorrent handle, i.e. a torrent is removed or corrupted, but Deluge still tries to access its status.

So, from the looks of it, Cleanuparr frequently, but not always, removes malware in a way that Deluge really does not like and leaves it in a nonfunctional state. Maybe a more careful/slow removal process could mitigate this?

Restarting the Deluge container resolves the issue, but it will eventually lock up again with "invalid torrent handle used" as long as Cleanuparr is running.

Not running Cleanuparr leaves Deluge absolutely stable, but eventually full of malware.

Which operating system do you use?

Unraid

What type of deployment do you use?

Docker container

Relevant log output

2025-08-24 10:59:04,214 DEBG 'watchdog-script' stderr output:

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/twisted/internet/base.py", line 705, in mainLoop
    self.runUntilCurrent()
  File "/usr/lib/python3.13/site-packages/twisted/internet/base.py", line 1090, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3.13/site-packages/twisted/internet/defer.py", line 877, in callback
    self._startRunCallbacks(result)
  File "/usr/lib/python3.13/site-packages/twisted/internet/defer.py", line 984, in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/lib/python3.13/site-packages/twisted/internet/defer.py", line 1078, in _runCallbacks
    current.result = callback(  # type: ignore[misc]
  File "/usr/lib/python3.13/site-packages/twisted/internet/task.py", line 872, in cb
    return callable(*args, **kw)
  File "/usr/lib/python3.13/site-packages/deluge/core/torrentmanager.py", line 1607, in on_alert_state_update
    self.handle_torrents_status_callback(self.torrents_status_requests.pop())
  File "/usr/lib/python3.13/site-packages/deluge/core/torrentmanager.py", line 1667, in handle_torrents_status_callback
    status_dict[torrent_id] = self.torrents[torrent_id].get_status(
  File "/usr/lib/python3.13/site-packages/deluge/core/torrent.py", line 1037, in get_status
    status_dict[key] = self.status_funcs[key]()
  File "/usr/lib/python3.13/site-packages/deluge/core/torrent.py", line 748, in get_eta
    status = self.status
  File "/usr/lib/python3.13/site-packages/deluge/core/torrent.py", line 1076, in status
    self.status = self.handle.status()
builtins.RuntimeError: invalid torrent handle used [libtorrent:20]

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions