Skip to content

fix: restart deluge-web when deluged is restarted by watchdog#443

Open
partymola wants to merge 1 commit into
binhex:masterfrom
partymola:fix/restart-deluge-web-on-daemon-restart
Open

fix: restart deluge-web when deluged is restarted by watchdog#443
partymola wants to merge 1 commit into
binhex:masterfrom
partymola:fix/restart-deluge-web-on-daemon-restart

Conversation

@partymola
Copy link
Copy Markdown

@partymola partymola commented Mar 2, 2026

When deluged crashes (e.g. segfault in libtorrent) and the watchdog restarts it, deluge-web is left running with a stale RPC connection to the old daemon.

It enters an endless connect/disconnect loop every ~2s:

Deluge Client connection made from: 127.0.0.1:49726
Deluge client disconnected: Connection to the other side was lost in a non-clean fashion: Connection lost.
Deluge Client connection made from: 127.0.0.1:49740
Deluge client disconnected: Connection to the other side was lost in a non-clean fashion: Connection lost.
...

The web UI loads but gets stuck on the Connection Manager screen. Only fix is restarting the whole container.

Root cause: in deluge.sh, when deluge_running == "false" the daemon gets restarted, but deluge-web is only started when deluge_web_running == "false". Since the web process is still alive (just with a broken RPC connection), it never gets restarted. deluge-web doesn't reconnect on its own when the daemon PID changes.

Fix: single file change in apps/nobody/deluge.sh. Before restarting deluged, kill deluge-web with SIGTERM and set deluge_web_running="false". The logic futher down in deluge.sh then starts it fresh alongside the new daemon.

Reproduced on binhex/arch-delugevpn:latest, Deluge 2.2.0, libtorrent 2.0.11-4, Python 3.13.7, boost 1.88.0-3. Confirmed via coredumpctl that deluged segfaults periodicaly in libtorrent which triggers the watchdog restart path.

@partymola partymola force-pushed the fix/restart-deluge-web-on-daemon-restart branch from d086284 to dd92556 Compare March 2, 2026 01:21
When deluged crashes (e.g. due to a segfault in libtorrent) and the
watchdog restarts it, deluge-web is left running with a stale RPC
connection to the old daemon. It enters an endless connect/disconnect
loop and the Web UI is stuck on the Connection Manager screen until
the entire container is restarted.

Fix this by stopping deluge-web before starting a new deluged instance
so that both processes start fresh. The existing logic at the bottom of
deluge.sh already handles starting deluge-web when deluge_web_running
is "false".
@partymola partymola force-pushed the fix/restart-deluge-web-on-daemon-restart branch from dd92556 to 681ebf0 Compare March 2, 2026 01:24
@partymola
Copy link
Copy Markdown
Author

Hi, just checking if you've had a chance to look at this. Happy to address any feedback.

@Makerblaker
Copy link
Copy Markdown

Looks great to me! I have run into this issue myself.

partymola added a commit to partymola/arch-delugevpn that referenced this pull request Apr 11, 2026
- Add GitHub Actions workflow to build and push to ghcr.io/partymola/arch-delugevpn
- Remove upstream binhex workflows (reference secrets and reusable workflows not available on fork)
- Update README to describe fork differences: rebuilt image with libtorrent 2.0.12+, watchdog fix (PR binhex#443), planned nftables support
@partymola
Copy link
Copy Markdown
Author

Just a heads up - I've created a fork at partymola/arch-delugevpn that includes this fix, is fully up to date with upstream, and has rebuilt images with current Arch packages (libtorrent 2.0.12, Python 3.14). It also includes the build fixes from #446 (7zip URL and python path resolution). Images are available at ghcr.io/partymola/arch-delugevpn:latest.

@Makerblaker in case it's useful for you too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants