[Deluge] #3465: Non-interactive deluge-console hangs on twisted errors

3 views
Skip to first unread message

Deluge

unread,
Apr 9, 2021, 9:46:26 AM4/9/21
to delug...@googlegroups.com
#3465: Non-interactive deluge-console hangs on twisted errors
----------------------------+------------------------
Reporter: jschauer | Type: bug
Status: new | Priority: minor
Milestone: needs verified | Component: Console UI
Version: develop | Keywords:
----------------------------+------------------------
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.

--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3465>
Deluge <https://deluge-torrent.org/>
Deluge Project

Deluge

unread,
Feb 15, 2022, 10:40:52 AM2/15/22
to delug...@googlegroups.com
#3465: Non-interactive deluge-console hangs on twisted errors
-------------------------+---------------------
Reporter: jschauer | Owner:
Type: bug | Status: new
Priority: minor | Milestone: 2.1.0

Component: Console UI | Version: develop
Resolution: | Keywords:
-------------------------+---------------------
Changes (by Cas):

* milestone: needs verified => 2.1.0


--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3465#comment:1>

Deluge

unread,
Feb 15, 2022, 10:47:36 AM2/15/22
to delug...@googlegroups.com
#3465: Non-interactive deluge-console hangs on twisted errors
-------------------------+---------------------
Reporter: jschauer | Owner:
Type: bug | Status: new
Priority: minor | Milestone: 2.1.0

Component: Console UI | Version: develop
Resolution: | Keywords:
-------------------------+---------------------

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>

Reply all
Reply to author
Forward
0 new messages