Opened 3 years ago

Last modified 2 years ago

#3465 new bug

Non-interactive deluge-console hangs on twisted errors

Reported by: jschauer Owned by:
Priority: minor Milestone: 2.1.1
Component: Console UI Version: develop
Keywords: Cc:

Description

Using the deluge-console frontend with commands instead of the interactive mode causes it to hang silently after a connection error and possibly from other twisted errors.

Observed on both system Gentoo deluge-2.0.3 and the current develop (3ec23ad96) in a virtualenv. Python3.8, twisted 20.3.

To reproduce:

  • Do not start a deluge daemon process
  • Use the deluge-console frontend in non-interactive mode.
    • eg deluge-console -Ldebug quit

Expected behavior: Command aborts with a non-debug level error message

Observed behavior: Command hangs indefinitely

The reason for this seems to be the error handler on_connect_fail in deluge.ui.console.main:exec_args. In this situation the parameter reason contains a twisted.failure.Failure with .value of type twisted.internet.error.ConnectError which does not have a member message causing an exception that will be caught silently somewhere.

Apparently any runtime exception in the error handler will silently be ignored and causes the application to hang. I do not have enough knowledge with twisted or deluge to know if this is expected behavior or how to fix the underlying problem.

For my local installation I've used this trivial patch to work around this specific error for now:

diff --git a/deluge/ui/console/main.py b/deluge/ui/console/main.py
index 23965bbb2..6d1e19d5c 100644
--- a/deluge/ui/console/main.py
+++ b/deluge/ui/console/main.py
@@ -207,7 +207,7 @@ def on_connect_fail(reason):
             if reason.check(DelugeError):
                 rm = reason.getErrorMessage()
             else:
-                rm = reason.value.message
+                rm = reason.value
             print(
                 'Could not connect to daemon: %s:%s\n %s'
                 % (options.daemon_addr, options.daemon_port, rm)

Unsure for which types the message member would be available instead of str() support.

Change History (3)

comment:1 by Calum, 3 years ago

Milestone: needs verified2.1.0

comment:2 by Calum, 3 years ago

Probably need something like:

-            if reason.check(DelugeError):
+            try:
                 rm = reason.getErrorMessage()
-            else:
+            except AttributeError:
                 rm = reason.value.message

comment:3 by Calum, 2 years ago

Milestone: 2.1.02.1.1

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.