Pomoc Bad response from server: (500 [error,list]) Link to XMLRPC failed. May be, rTorrent is down?

alexsmith2709

Passing Basics
Beginner
1 Listopad 2015
24
0
1
36
QNAP
TS-x53
Ethernet
1 GbE
Ever since upgrading to rtorrent pro and using a VPN i get the error "Bad response from server: (500 [error,list]) Link to XMLRPC failed. May be, rTorrent is down?" pretty much every day and sometimes if i close rutorrent web page and re-open it i get the error "No connection to rTorrent. Check if it is really running. Check $scgi_port and $scgi_host settings in config.php and scgi_port in rTorrent configuration file." This is not ideal. rTorrent-Pro also takes about 10mins+ to start if i need to restart it, the non pro version never took this long. What could be going wrong and how do i stop this happening? I am using rtorrent-pro V0.9.6-0419.
This is in the crash log file:
1559757003 W Ignoring ~/.rtorrent.rc.
1559757003 C Caught exception: 'Could not open/bind port for listening: Cannot assign requested address'.

The VPN is connected and shows as been connected the whole time

Firmware version: 4.3.4.0695 Build 20180830
Model name: QNAP TS-253 Pro
 
What would you like to know about the VPN? Its set up in QVPN, it says connected and the time connected shows long enough to when rtorrent was working. Its set in the interface list correctly. It works to start with then it seems rtorrent decides it cant connect to it. A restart of rtorrent will usually solve the issue, but as stated that takes about 10 mins.
If i noticed that the VPN connection kept dropping in QVPN i would understand, but it doesnt.
 
Do you think your VPN provider switches your IP every 10 minutes?
If yes so, then please try to follow this guide:
You made me a lot of additional work....
Yeap I found a way to refresh this IP automatically for ya.

It's not so easy to apply that changes into the whole program, but I can give you a easy mod for now.

1) edit: /usr/bin/rtorrent/etc/rtorrent.conf.tpl
Replace:
Kod:
[[server_bind_line]]
To this:
Kod:
# Lets bind correct IP address for the listening socket and outgoing connections.
# To do this we have to figure out an name of interface with IPv4 address to bind to: [qvs0|bond0|eth0|tun0]
method.insert = cfg.interface.bind, simple|private, \
    "execute.capture_nothrow=sh,-c,\"$cat=\\\"bindif=`getcfg rtorrent bind_interface_name -f /etc/config/qpkg.conf` \
                                              || bindif=`route | grep '^default' | grep -o '[^ ]*$'` ; \
                                              ifconfig 2>/dev/null | grep -q $bindif 2>/dev/null \
                                                  && echo -n $bindif \
                                                  || echo -n $(route | grep '^default' | grep -o '[^ ]*$')  \\\"\""
print = (cat, "Iface  : Default network interface : ", (cfg.interface.bind))
# Get IPv4 address of a given interface
method.insert = get_interface_ipv4_address, simple|private, \
    "execute.capture=sh,-c,\"$cat=\\\"echo -n \$(ip -o -4 addr show \\\",$argument.0=,\\\" | grep -Po 'inet \\\\\\\\\\K[\\\\\\\\\\d.]+')\\\"\""
# The IP address the listening socket and outgoing connections is bound to. (bind)
# (Refresh every 10 seconds)
schedule2 = set_bind_address, 0, 10, \
    "branch=((cfg.interface.bind)), \
            ((network.bind_address.set,(get_interface_ipv4_address,(cfg.interface.bind))))"
#print = (cat, "Bind IP: Get def interface IPv4addr: ", (get_interface_ipv4_address,(cfg.interface.bind)))
print = (cat, "Bind IP: Current interface IPv4addr: ", (network.bind_address))
schedule2 = print_bind_address, 0, 0, "print = (cat, \"Bind IP: Current interface IPv4addr: \", (network.bind_address))"


# The ip address reported to the tracker
# Get public IP address without the need of having dynamic DNS service, also works from behind NAT, through tunnel
method.insert = get_public_ip_address, simple|private, \
    "execute.capture_nothrow=sh,-c,\"$cat=\\\"echo -n \$(\
    curl -sL --connect-timeout 10 --interface \\\", (cfg.interface.bind), \\\" http://ipinfo.io/ip || \
    curl -sL --connect-timeout 15 --interface \\\", (cfg.interface.bind), \\\" http://icanhazip.com || \
    curl -sL --connect-timeout 20 --interface \\\", (cfg.interface.bind), \\\"  http://obj.qnapclub.pl/app/net/ip.php || \
    echo -n 127.0.0.1)\\\"\""
# The IP address reported to the tracker. (ip) This handles dynamic IP's as well. Fallback to localhost for safety reasons.
# (Refresh your outgoing IP every (10*3)+(10+15+20)+5 extra seconds)
schedule2 = ip_tick, 0, 80, "network.local_address.set=(get_public_ip_address);print = (cat, \"New Public IP address: \", (network.local_address))"
WOT - yeah I know :D

2. find your vpn tunel interface name in ifconfig list:
Bash:
ifconfig | grep tun
you said it was tun2002 previously
make sure. because...

3. set this interface name into the config:
Bash:
setcfg rtorrent bind_interface_name tun2002 -f /etc/config/qpkg.conf
PLS REMEMBER THIS NOTE:
from that moment no matter what IP interface you will select in rtorrent settings UI, from now tun2002 will be primary interface and will fallback to the system default only if it's not available anymore in the system
so when setting in the UI otther interface like network adapter 2, other tunnel... will not work
from that moment this command is your primary interface setting

4. final step, go to the rtorrent settings, dont care about selected bind IP interface (as said above) and just click "Save settings" - this is necessary to regenerate new config files from the templates you made

btw: i know replacing text to text sometimes its bit difficult so I'm attaching my .tpl files and you can replace them (these files are from upcoming rtorrent RC3.a release I cannot guarantee that will work, but try first) - repleace all files, and follow guide from step 2!

BTW: If you think its helpful, then please dont forget to support my work:
Pay using PayPal.Me
QNAP Apps Development
Buy Silas Mariusz a Coffee. ko-fi.com/silasmariusz
Patron Checkout | Patreon
 
Thanks, i will try that if i have to but the IP does seem to stay the same. It generated a new IP when i restarted the VPN last and QVPN is now showing the connection as being up for 102 hours and rtorrent has only lost connection once in that time. Its possible that some routing through the previous IP or traffic on that particular server was causing instability.

I will keep monitoring it and let you know my findings.