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.
--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3465>
Deluge <https://deluge-torrent.org/>
Deluge Project
* milestone: needs verified => 2.1.0
--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3465#comment:1>
Comment (by Cas):
Probably need something like:
{{{
- if reason.check(DelugeError):
+ try:
rm = reason.getErrorMessage()
- else:
+ except AttributeError:
rm = reason.value.message
}}}
--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3465#comment:2>