Deluged and python-twisted

Required Information

  • DietPi version | cat /boot/dietpi/.version
G_DIETPI_VERSION_CORE=9
G_DIETPI_VERSION_SUB=6
G_DIETPI_VERSION_RC=1
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
  • Distro version: bookworm 1
  • Kernel version: Linux gimp 6.1.21+ #1642 Mon Apr 3 17:19:14 BST 2023 armv6l GNU/Linux
  • Architecture: armhf
  • SBC model: RPi B (armv6l)

Additional Information (if applicable)

  • Software title: deluged
  • Was the software title installed freshly or updated/migrated? fresh install
  • Can this issue be replicated on a fresh installation of DietPi? I don't know
  • Bug report ID: HWID: bc56e0f3-0261-4d2a-a401-3119201a92c0

Steps to reproduce

  1. run as user: /usr/bin/deluged --port=58846 --config=${HOME}/.config/deluge/
  2. watch it crash

Expected behaviour

  • deluged should come up

Actual behaviour

  • deluged crashes with the following error:
Unhandled error in Deferred:
20:42:48 [CRITICAL][twisted                       :147 ] Unhandled error in Deferred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/common.py", line 1344, in run_profiled
    return func(*args)
  File "/usr/lib/python3/dist-packages/deluge/core/daemon_entry.py", line 132, in run_daemon
    log.error('Unable to start deluged: %s', ex)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1905, in unwindGenerator
    return _cancellableInlineCallbacks(gen)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1815, in _cancellableInlineCallbacks
    _inlineCallbacks(None, gen, status)
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1660, in _inlineCallbacks
    result = current_context.run(gen.send, result)
  File "/usr/lib/python3/dist-packages/deluge/log.py", line 79, in error
    yield LoggingLoggerClass.error(self, msg, *args, **kwargs)
  File "/usr/lib/python3.11/logging/__init__.py", line 1518, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.11/logging/__init__.py", line 1622, in _log
    fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
builtins.TypeError: Logging.findCaller() takes from 1 to 2 positional arguments but 3 were given

Temporarily disabling observer LegacyLogObserverWrapper(<bound method TwistedLoggingObserver.emit of <deluge.log.TwistedLoggingObserver object at 0xb59ab510>>) due to exception: [Failure instance: Traceback: <class 'TypeError'>: Logging.findCaller() takes from 1 to 2 positional arguments but 3 were given
/usr/lib/python3/dist-packages/twisted/internet/defer.py:344:__del__
/usr/lib/python3/dist-packages/twisted/logger/_logger.py:190:failure
/usr/lib/python3/dist-packages/twisted/logger/_logger.py:142:emit
--- <exception caught here> ---
/usr/lib/python3/dist-packages/twisted/logger/_observer.py:81:__call__
/usr/lib/python3/dist-packages/twisted/logger/_legacy.py:90:__call__
/usr/lib/python3/dist-packages/deluge/log.py:204:emit
/usr/lib/python3.11/logging/__init__.py:1536:critical
/usr/lib/python3.11/logging/__init__.py:1622:_log
]
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 344, in __del__
    log.failure(format, self.failResult, debugInfo=debugInfo)
  File "/usr/lib/python3/dist-packages/twisted/logger/_logger.py", line 190, in failure
    self.emit(level, format, log_failure=failure, **kwargs)
  File "/usr/lib/python3/dist-packages/twisted/logger/_logger.py", line 142, in emit
    self.observer(event)
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/logger/_observer.py", line 81, in __call__
    observer(event)
  File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 90, in __call__
    self.legacyObserver(event)
  File "/usr/lib/python3/dist-packages/deluge/log.py", line 204, in emit
    getattr(LoggingLoggerClass, event_dict['log_level'].name)(
  File "/usr/lib/python3.11/logging/__init__.py", line 1536, in critical
    self._log(CRITICAL, msg, args, **kwargs)
  File "/usr/lib/python3.11/logging/__init__.py", line 1622, in _log
    fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
builtins.TypeError: Logging.findCaller() takes from 1 to 2 positional arguments but 3 were given

it sounds to me like deluged tries to use twisted wrongly, which kinda points to version mismatch between what deluged expects and what is actually installed.

Extra details

  • the error seems to depend on my deluged config; if I delete ~/.config/deluge, then the services comes up fine; I have not found anything related to logging in my config though, so I suspect that, with an empty config, it just doesn’t have anything to say and, as soon as it would try to say anything, it’s wrong call to twisted would crash it again, but that’s wild speculation…
  • I have not played with any python package managers like pip etc. everything is installed from the - I tried purging and re-installing deluged and twisted, but no game.
  • my deluge-web also has issues with gettext, but those aren’t fatal at least

Maybe something that you would need to check with deluged developer.