Description
When using Gluetun with ProtonVPN WireGuard and qsticky to update qBittorrent's listening port, the port flaps between the old port (61557) and the new forwarded port (33467). This causes repeated port change attempts and log spam in both qBittorrent and qsticky.
Logs
qBittorrent Log
qBittorrent v5.1.2 started. Process ID: 147
Using config directory: /config/qBittorrent
Trying to listen on the following list of IP addresses: "10.2.0.2:61557"
Peer ID: "-qB5120-"
HTTP User-Agent: "qBittorrent/5.1.2"
Distributed Hash Table (DHT) support: ON
Local Peer Discovery support: OFF
Peer Exchange (PeX) support: OFF
Anonymous mode: ON
Encryption support: ON
Successfully listening on IP. IP: "10.2.0.2". Port: "TCP/61557"
Successfully listening on IP. IP: "10.2.0.2". Port: "UTP/61557"
IP geolocation database loaded. Type: DBIP-Country-Lite. Build time: Wed Oct 1 03:26:02 2025.
Using built-in WebUI.
WebUI translation for selected locale (en) has been successfully loaded.
WebUI: Now listening on IP: *, port: 8080
WebAPI login success. IP: ::ffff:172.16.4.1
Failed to listen on IP. IP: "10.2.0.2". Port: "TCP/61557". Reason: "Address not available"
Successfully listening on IP. IP: "10.2.0.2". Port: "TCP/61557"
Successfully listening on IP. IP: "10.2.0.2". Port: "UTP/61557"
WebAPI login success. IP: ::ffff:172.16.4.3
Trying to listen on the following list of IP addresses: "10.2.0.2:33467"
Successfully listening on IP. IP: "10.2.0.2". Port: "TCP/33467"
Successfully listening on IP. IP: "10.2.0.2". Port: "UTP/33467"
WebAPI login success. IP: ::ffff:172.16.4.1
WebAPI login success. IP: ::ffff:172.16.4.1
WebAPI login success. IP: ::ffff:172.16.4.1
Trying to listen on the following list of IP addresses: "10.2.0.2:61557"
Successfully listening on IP. IP: "10.2.0.2". Port: "TCP/61557"
Successfully listening on IP. IP: "10.2.0.2". Port: "UTP/61557"
WebAPI login success. IP: ::ffff:172.16.4.3
Trying to listen on the following list of IP addresses: "10.2.0.2:33467"
Successfully listening on IP. IP: "10.2.0.2". Port: "TCP/33467"
Successfully listening on IP. IP: "10.2.0.2". Port: "UTP/33467"
WebAPI login success. IP: ::ffff:172.16.4.3
WebAPI login success. IP: ::ffff:172.16.4.1
WebAPI login success. IP: ::ffff:172.16.4.1
Trying to listen on the following list of IP addresses: "10.2.0.2:61557"
Successfully listening on IP. IP: "10.2.0.2". Port: "TCP/61557"
Successfully listening on IP. IP: "10.2.0.2". Port: "UTP/61557"
WebAPI login success. IP: ::ffff:172.16.4.3
Trying to listen on the following list of IP addresses: "10.2.0.2:33467"
Successfully listening on IP. IP: "10.2.0.2". Port: "TCP/33467"
Successfully listening on IP. IP: "10.2.0.2". Port: "UTP/33467"
qsticky Log
2025-10-20 19:24:22,458 - qsticky - INFO - Starting qSticky port manager (commit: 23ac5ae)...
2025-10-20 19:24:53,279 - qsticky - INFO - Successfully logged in to qBittorrent
2025-10-20 19:24:53,280 - qsticky - INFO - Port change needed: 61557 -> 33467
2025-10-20 19:24:53,297 - qsticky - INFO - Successfully updated port to 33467
2025-10-20 19:25:23,867 - qsticky - INFO - Port change needed: 61557 -> 33467
2025-10-20 19:25:23,895 - qsticky - INFO - Successfully updated port to 33467
2025-10-20 19:26:24,996 - qsticky - INFO - Port change needed: 61557 -> 33467
2025-10-20 19:26:25,011 - qsticky - INFO - Successfully updated port to 33467
2025-10-20 19:27:26,127 - qsticky - INFO - Port change needed: 61557 -> 33467
2025-10-20 19:27:26,139 - qsticky - INFO - Successfully updated port to 33467
2025-10-20 19:28:27,255 - qsticky - INFO - Port change needed: 61557 -> 33467
2025-10-20 19:28:27,297 - qsticky - INFO - Successfully updated port to 33467
Expected Behavior
qBittorrent should listen only on the new forwarded port (33467) after qsticky updates it, and not revert to the old port (61557).
Actual Behavior
qBittorrent alternates between the old and new ports, causing repeated port updates and log spam.
Environment
- Gluetun: latest
- ProtonVPN: WireGuard
- qBittorrent: v5.1.2
- qsticky: commit 23ac5ae
- Docker: TrueNAS SCALE
Configuration
- Gluetun is configured with
VPN_PORT_FORWARDING=on and PORT_FORWARD_ONLY=on.
- qBittorrent is configured to use Gluetun's network stack (
network_mode: service:gluetun).
- qsticky is configured to update qBittorrent's port using Gluetun's API.
Possible Cause
It seems that either:
- Gluetun is not consistently providing the forwarded port to qsticky, or
- qBittorrent is not retaining the new port and reverts to the old one after a short time.
Suggested Fix
Investigate why qBittorrent reverts to the old port and ensure the new port is persisted after the update. This may involve checking how Gluetun handles port forwarding updates or how qsticky interacts with Gluetun's API.
Additional Context
- The issue occurs even when the port is successfully updated by qsticky.
- The logs show that qsticky repeatedly detects the old port and updates it to the new one, indicating a loop.
Description
When using Gluetun with ProtonVPN WireGuard and qsticky to update qBittorrent's listening port, the port flaps between the old port (
61557) and the new forwarded port (33467). This causes repeated port change attempts and log spam in both qBittorrent and qsticky.Logs
qBittorrent Log
qsticky Log
Expected Behavior
qBittorrent should listen only on the new forwarded port (
33467) after qsticky updates it, and not revert to the old port (61557).Actual Behavior
qBittorrent alternates between the old and new ports, causing repeated port updates and log spam.
Environment
Configuration
VPN_PORT_FORWARDING=onandPORT_FORWARD_ONLY=on.network_mode: service:gluetun).Possible Cause
It seems that either:
Suggested Fix
Investigate why qBittorrent reverts to the old port and ensure the new port is persisted after the update. This may involve checking how Gluetun handles port forwarding updates or how qsticky interacts with Gluetun's API.
Additional Context