apache errors, rutorrent crashes rtorrent

lisas4567

Member
May 25, 2018
773
0
16
I am experiencing a few problems:

the last two weeks, I started to see server 400 errors when I sent a browser request
Code:
Your browser sent a request that this server could not understand
Sometimes deleting cookies helped, sometimes I just had to try again and again and it would suddenly work :)

But what is happening now is that, after rutorrent has been running a while, it will crash rtorrent (running in screen mode) and I will get a 500 server internal error
Code:
The server encountered an internal error or misconfiguration and was unable to complete your requestand it will refer me to the server error log.

If I then refresh rutorrent, I get:
Code:
Bad link 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.
apache error log repeatedly shows the following error:
Code:
[error] [client *myip*] (111)Connection refused: scgi: scgi: can't connect to server, referer: https://myserverip/rutorrent/
As I said, this started with browser request errors, but now I am getting to the stage where rtorrent crashes. The screen session with rtorrent is indeed gone, screen -ls shows no screens running.

I can restart screen rtorrent and repeat this process, but after five minutes of rutorrent it will freeze and give me the 500 server error.

Any help would be appreciated.
 

lisas4567

Member
May 25, 2018
773
0
16
Here's a copy of my configuration file:
Code:
# Maximum and minimum number of peers to connect to per torrent.
#min_peers = 40
max_peers = 100

# Same as above but for seeding completed torrents (-1 = same as downloading)
min_peers_seed = -1
max_peers_seed = -1

# Maximum number of simultanious uploads per torrent.
max_uploads = 50

# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 0

# Default directory to save the downloaded torrents.
directory = /home/downloads/rtor

# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = /home/downloads/rtor/.session

# Watch a directory for new torrents, and stop those that have been
# deleted.
schedule = watch_directory,5,5,load_start=/home/downloads/rtor/watch/*.torrent
schedule = untied_directory,5,5,stop_untied=

# Close torrents when diskspace is low. */
schedule = low_diskspace,5,60,close_low_diskspace=100M

# Stop torrents when reaching upload ratio in percent,
# when also reaching total upload in bytes, or when
# reaching final upload ratio in percent.
# example: stop at ratio 2.0 with at least 200 MB uploaded, or else ratio 20.0
#schedule = ratio,60,60,stop_on_ratio=200,200M,2000


# When the torrent finishes, it executes "mv -n <base_path> ~/Download/"
# and then sets the destination directory to "~/Download/". (0.7.7+)
# on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,/home/downloads/$

# The ip address reported to the tracker.
#ip = 127.0.0.1
#ip = rakshasa.no

# The ip address the listening socket and outgoing connections is
# bound to.
#bind = 127.0.0.1
#bind = rakshasa.no

# Port range to use for listening.
port_range = xxxx-xxxxx


# Start opening ports at a random position within the port range.
#port_random = yes

scgi_port = 127.0.0.1:5000

# Check hash for finished torrents. Might be usefull until the bug is
# fixed that causes lack of diskspace not to be properly reported.
#check_hash = no

# Set whetever the client should try to connect to UDP trackers.
#use_udp_trackers = no

# Alternative calls to bind and ip that should handle dynamic ip's.
#schedule = ip_tick,0,1800,ip=rakshasa
#schedule = bind_tick,0,1800,bind=rakshasa

# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plai$
#
# The example value allows incoming encrypted connections, starts unencrypted
# outgoing connections but retries with encryption if they fail, preferring
# plaintext to RC4 encryption after the encrypted handshake
#
encryption = allow_incoming,enable_retry,prefer_plaintext

# Enable DHT support for trackerless torrents or when all trackers are down.
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).
# The default is "off". For DHT to work, a session directory must be defined.
#
dht = disable

# UDP port to use for DHT.
#
# dht_port = 6881

# Enable peer exchange (for torrents not marked private)
#
peer_exchange = no

#
# Do not modify the following parameters unless you know what you're doing.
#

# Hash read-ahead controls how many MB to request the kernel to read
# ahead. If the value is too low the disk may not be fully utilized,
# while if too high the kernel might not be able to keep the read
# pages in memory thus end up trashing.
#hash_read_ahead = 10

# Interval between attempts to check the hash, in milliseconds.
#hash_interval = 100

# Number of attempts to check the hash while using the mincore status,
# before forcing. Overworked systems might need lower values to get a
# decent hash checking rate.
#hash_max_tries = 10

# Max number of files to keep open simultaniously.
#max_open_files = 128

# Number of sockets to simultaneously keep open.
#max_open_sockets = <no default>


# Example of scheduling commands: Switch between two ip's every 5
# seconds.
#schedule = "ip_tick1,5,10,ip=torretta"
#schedule = "ip_tick2,10,10,ip=lampedusa"

# Remove a scheduled event.
#schedule_remove = "ip_tick1"
 

peshua19

Member
May 25, 2018
897
0
16
this sounds webserver related.

post errors from apache logs (or whichever webserver you use)
 

lisas4567

Member
May 25, 2018
773
0
16
These are the latest errors in the apache error log:

Code:
[Fri Aug 06 07:03:15 2010] [error] [client x.x.x.x] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Fri Aug 06 07:13:18 2010] [error] [client x.x.x.x] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)

But rutorrent/ rtorrent are not running now. When they were still running, I would get:

Code:
[error] [client *myip*] (111)Connection refused: scgi: scgi: can't connect to server, referer: https://myserverip/rutorrent/
I also think think it is apache related, as it started with the browser request errors and I can still get rtorrent and rutorrent to run. However, they will crash after some time.

I am using ubuntu server 10.04, fully up-to-date.
 

lisas4567

Member
May 25, 2018
773
0
16
I just tried again, the same thing happened. This time I got this error from apache:
Code:
[error] [client *myIP*] Premature end of script headers: RPC2, referer: https://serverip/rutorrent/

From the rtorrent.rc file:

Code:
scgi_port = 127.0.0.1:5000
from the apache2.conf file:

Code:
SCGIMount /RPC2 127.0.0.1:5000
servername localhost
I just reloaded apache and got the following message:

Code:
[warn] _default_ VirtualHost overlap on port 443, the first has precedence
I think it has something to do with binding apache to 127.0.0.1, however this is not specified in the installation tutorial from this site? Google brings up several people that have encounted this issue.

I tried adding some lines to apache2/ports.conf to make apache listen to 127.0.0.1 but then I would get other errors (Error in option file: ~/.rtorrent.rc:74: Could not prepare socket for listening: Address already in use). I had to restore my previous conf to get rtorrent running again.

I think I am getting closer to the solution, but I haven't quite found it :) If anyone could point me in the right direction, I'd be grateful.
 

lisas4567

Member
May 25, 2018
773
0
16
I used the tutorial available from here: http://forums.rutorrent.org/index.php?topic=256.0

This is what I added to the apache conf file (nothing else, rest of the file can be seen at the tutorial linked above):

Code:
SCGIMount /RPC2 127.0.0.1:5000
servername localhost
From this post: http://libtorrent.rakshasa.no/ticket/1793 ,
I can see that other people have experienced similar problems. The advice is to bind apache to 127.0.0.1:80. However, if I try to bind apache to 127.0.0.1, shouldn't I use port 5000? 127.0.0.1:80 didn't work for me. What puzzles me is that it all used to work without any problems, and that only lately did apache run into problems. Starting to spread now, as rtorrent will crash within screen, with or without rutorrent. Rtorrent by itself keeps on going, but when I run it in screen mode, and after detaching 'ctrl +a +d' I cannot resume the screen 'screen -r'; I can see both screen and rtorrent running with ps -A but screen -ls only brings up 'No Sockets found in /var/run/screen/S-rtor.' I don't know if this issue ties in with the other issues I am seeing.

When I start rtorrent, I get this warn:

Code:
The SCGI socket is bound to a specific network device yet may still pose a security risk, consider using 'scgi_local'
Is the warn that I get within rtorrent of any significance, in that I should use scgi_local?

Rascalli asked me if I can reach rutorrent without ssl. I can also connect with http (https also works). Both http and https connections will result in 500 internal errors after some time. The solution you linked doesn't seem to be useful as those parameters do not apply. Thank you for your reply though.
 

lisas4567

Member
May 25, 2018
773
0
16
isn't vhost also what I used i.e. as in the tutorial linked above? Could you please elaborate why and how I should use the file you linked? It differs from the one used in the tutorial in several instances. We are talking about /etc/apache2/sites-available/default, right?