Newcomer1989 / TSN-Ranksystem

A PHP Bot that assigns time based server groups on TeamSpeak3.
https://ts-ranksystem.com
GNU General Public License v3.0
144 stars 60 forks source link

Page no load - 503 Service unavailble #554

Closed javierlechuXD closed 5 years ago

javierlechuXD commented 6 years ago

Hello everyone

My problem is that from time to time my web stops working

Service Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request.

But after a few minutes it will be online again but the bot is off I think the problem occurs when the bot has to work or do something

I do not know if the problem may be because I have not configured the Cron Jobs in Cpanel

/10 * sudo -u www-data php /path/to/your/websever/path/to/Ranksystem/worker.php check >/dev/null 2>&1

How should I configure it to /Estadisticas.gameflix.es/worker.php

that's OK? sudo -u www-data php /home/gameflix/Estadisticas.gameflix.es/worker.php check >/dev/null 2>&1

or

sudo -u /opt/alt/php71/usr/bin/php /home/gameflix/Estadisticas.gameflix.es/worker.php check >/dev/null 2>&1

actual configuration: https://i.gyazo.com/a1a16ebb84f1107de3b685eab857822b.png

Currently still with the same error

My info server

Item Detail
Hosting Package roxwebfr_pro
Server Name panel
cPanel Version 74.0 (build 8)
Apache Version 2.4.34
Architecture x86_64
Operating System linux
Shared IP Address 37.187.50.147
Path to Sendmail /usr/sbin/sendmail
Path to Perl /usr/bin/perl
Perl Version 5.10.1
Kernel Version 2.6.32-896.16.1.lve1.4.54.el6.x86_64
Service Details Status
cpanel-dovecot-solr up  
queueprocd up  
cpanel_php_fpm up  
ipaliases up  
lfd up  
cpsrvd up  
cpdavd up  
crond up  
nscd up  
httpd (2.4.34 (cPanel)) up  
letsencrypt-cpanel up  
clamd up  
mailman up  
rsyslogd up  
spamd up  
p0f up  
mysql (5.6.40) up  
dnsadmin up  
imap up  
ftpd up  
exim (exim-4.91-3.cp1170.x86_64) up  
pop up  
sshd up  
lmtp up  
cpanellogd up  
named up  
Server Load 0.26 (8 cpus)  
Memory Used 28.35 %  
Swap 18.69 %  
Disk / (/) 69 %  
Disk /tmp (/tmp) 8 %  
Disk /var/tmp (/var/tmp) 8 %  
javierlechuXD commented 6 years ago

I have checked that the bot stops working when there is a change or a user enters the server. The page stops working too

Shad86 commented 6 years ago

Hello,

If I see that right, you're using a webspace?

how does the config look in "other", is hashing enabled in your config? has-tsn

If it mostly happen if a user joins, it could maybe that this is to much for the webserver, so try disable it and look if it still happens.

"if there is a change" <- What do you mean with it? That could be everything.

If that is so, then you have to consider to change another setting as this is a common issue with rented webspaces, the most excuse is, that the load is too high and that the service is getting terminated.

So activate the "Query Slowmode" in the Webinterface under TeamSpeak and set it to a "high delay" realtime-tsn

This will reduce the load and could result in an improvement.

regards

Shad86

Newcomer1989 commented 6 years ago

javierlechuXD, we have written yesterday on our public teamspeak server. I do not understand, you are opening a ticket now.

We host the Ranksystem for you. Our page is available and have no 503 server error. You are using your own domain address and do a redirect. Your redirect is the problem, not the Ranksystem. https://ts-n.net/host/rs/79/stats/

As already written yesterday, you need to correct this. Perhaps your hoster could help you with.

javierlechuXD commented 6 years ago

The host of the web asks me what is the script that the bot uses to work

He asks me if it's the next /worker.php

Surely you want to know to grant permissions to that Script on your server

javierlechuXD commented 6 years ago

javierlechuXD, we have written yesterday on our public teamspeak server. I do not understand, you are opening a ticket now.

We host the Ranksystem for you. Our page is available and have no 503 server error. You are using your own domain address and do a redirect. Your redirect is the problem, not the Ranksystem. https://ts-n.net/host/rs/79/stats/

As already written yesterday, you need to correct this. Perhaps your hoster could help you with.

I greatly appreciate the host that you gave me, We are currently using it and it works well for our main server, But we want to have a host on our server to test with our secondary TS3 server

javierlechuXD commented 6 years ago

According to the host of my website, the bot gives security errors in cpanel since it is considered as suspicious process

Newcomer1989 commented 6 years ago

The host of the web asks me what is the script that the bot uses to work

The Ranksystem is describes here: https://ts-n.net/ranksystem.php#howto

According to the host of my website, the bot gives security errors in cpanel since it is considered as suspicious process

Which errors? Please share us more informations. 1) We need to know, what you have done and where are you.. 2) Where does the error occurs? 3) Share us the exact error message

JoniVR commented 5 years ago

Same thing here, I've checked the ranksystem.log file for anything but it doesn't look like it.

I do remember enabling the "hash IP addresses" recently.. Since I couldn't get into the settings panel (page was unreachable of course), I disabled the setting through the SQL db with the command:

[ts3_ranksystem]> update config set iphash = 0;

I then tried restarting it by running: php worker.php restart But that didn't help either. The other parts of the site are still working fine. Any suggestions? Am I missing something?

My server is also quite high-end and doesn't have a lot of load, so I honestly don't think it's a performance issue.

image

Newcomer1989 commented 5 years ago

Can you please share us your webserver log in that moment, you are entering the webinterface.

You get this error permanent? Which site you like to enter? The webinterface?

JoniVR commented 5 years ago

Yes, this error stays on, whatever I do, the worker.php is running as usual and the log files don't report anything special. I get it on the entire ranksystem (as far as I'm aware) but nothing else is affected (even though it's running on the same server).

You can check out the pages for yourself: https://vitaltactic.be/ranksystem/

Main site is still up and running: https://vitaltactic.be/

Let me know if you want me to provide anything else (logs, specific files, ...)

Newcomer1989 commented 5 years ago

We need the part of the webserver log!

JoniVR commented 5 years ago

Alright, I'm sorry I misunderstood your last comment.

So the access.log from apache doesn't show anything interesting except for which requests where made and it really only contains data which I don't feel like I need or want to share here. It's basically all the GET requests without anything useful in it.

here's a line from error.log that appears constantly (also apache2 logs) and might be interesting:

Sat Jan 05 23:00:13.929312 2019] [proxy_fcgi:error] [pid 28329] [client <ip>] AH01079: failed to make connection to backend: httpd-UDS
[Sat Jan 05 23:01:42.293760 2019] [proxy:error] [pid 25976] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php7.2-fpm.sock (*) failed

Here's the ranksystem.log:

2019-01-04 23:19:25.574960   INFO      Received signal to stop! Shutting down!
2019-01-04 23:19:35.981034   INFO      ###################################################################
2019-01-04 23:19:35.981169   INFO      
2019-01-04 23:19:35.981194   INFO      ###################################################################
2019-01-04 23:19:35.981214   INFO      Initialize Bot...
2019-01-04 23:19:35.984260   DEBUG     Running on OS: Linux 3.16.0-5-amd64
2019-01-04 23:19:35.984316   DEBUG     Using PHP Version: 7.2.4-1+b2
2019-01-04 23:19:35.984343   DEBUG     Database Version: 5.5.5-10.1.35-MariaDB-1
2019-01-04 23:19:35.984364   INFO      Check Ranksystem database for updates...
2019-01-04 23:19:35.984386   INFO        No newer version detected; Database check finished.
2019-01-04 23:19:35.984631   INFO        Check files permissions...
2019-01-04 23:19:35.987747   INFO        Check files permissions [done]
2019-01-04 23:19:35.987791   INFO      Check Ranksystem database for updates [done]
2019-01-04 23:19:35.987813   INFO      Check Ranksystem files for updates...
2019-01-04 23:19:35.987836   INFO      Check Ranksystem files for updates [done]
2019-01-04 23:19:35.987856   INFO      Ranksystem Version: 1.2.11
2019-01-04 23:19:35.987876   INFO      Loading addons...
2019-01-04 23:19:35.988063   INFO        Addon: 'assign_groups' [OFF]
2019-01-04 23:19:35.988091   INFO      Loading addons [done]
2019-01-04 23:19:35.988112   INFO      Connect to TS3 Server (Address: "108.61.177.215" Voice-Port: "9987" Query-Port: "10011" SSH: "0").
2019-01-04 23:19:35.994550   INFO      Connection to TS3 Server established.
2019-01-04 23:19:35.994857   INFO        TS3 Server version: 3.5.1 on Linux [Build: 1545076855 from 2018-12-17 21:00:55]
2019-01-04 23:19:35.994904   INFO          Select virtual server...
2019-01-04 23:19:36.199170   INFO          Select virtual server [done]
2019-01-04 23:19:36.601095   ERROR       Could not join specified channel (Channel ID: 5) - 768: invalid channelID
2019-01-04 23:19:36.601160   INFO      Config check started...
2019-01-04 23:19:36.601610   INFO      Config check [done]
2019-01-04 23:19:36.601678   INFO      Bot starts now his work!
2019-01-04 23:21:14.526842   INFO      Download avatar: /avatar_lffnigopjlcejcoelghjflkfddghakdafaiafldl
2019-01-04 23:21:14.728476   INFO      Download avatar: /avatar_nnjpjpeognhgpphmmgiimladngdhfbobjekalefd
2019-01-04 23:21:17.988916   INFO      Download avatar: /avatar_lffnigopjlcejcoelghjflkfddghakdafaiafldl
2019-01-04 23:21:18.190123   INFO      Download avatar: /avatar_nnjpjpeognhgpphmmgiimladngdhfbobjekalefd
2019-01-04 23:23:27.243468   INFO      Download avatar: /avatar_lffnigopjlcejcoelghjflkfddghakdafaiafldl
2019-01-04 23:23:30.506116   INFO      Download avatar: /avatar_lffnigopjlcejcoelghjflkfddghakdafaiafldl
2019-01-04 23:23:36.849968   INFO      Download avatar: /avatar_nnjpjpeognhgpphmmgiimladngdhfbobjekalefd
2019-01-04 23:26:20.976952   INFO      Download avatar: /avatar_lffnigopjlcejcoelghjflkfddghakdafaiafldl
2019-01-04 23:26:21.178195   INFO      Download avatar: /avatar_nnjpjpeognhgpphmmgiimladngdhfbobjekalefd
2019-01-04 23:26:24.436814   INFO      Download avatar: /avatar_lffnigopjlcejcoelghjflkfddghakdafaiafldl
2019-01-04 23:26:24.638166   INFO      Download avatar: /avatar_nnjpjpeognhgpphmmgiimladngdhfbobjekalefd
< ... lots of more "Download avatar" lines I removed for your sanity. ... >
2019-01-05 14:41:17.863656   INFO      Download avatar: /avatar_lffnigopjlcejcoelghjflkfddghakdafaiafldl
2019-01-05 14:44:33.920700   INFO      Download avatar: /avatar_nnjpjpeognhgpphmmgiimladngdhfbobjekalefd

I removed some of the Download avatar lines from that because it would get really long, but I double checked nothing else was in there.

Let me know if you need anything else.

JoniVR commented 5 years ago

Managed to get it back up end running by restarting that service: sudo service php7.2-fpm restart and then manually restarting the worker.php again.

Newcomer1989 commented 5 years ago

Ok, the decisive message is this:

Sat Jan 05 23:00:13.929312 2019] [proxy_fcgi:error] [pid 28329] [client ] AH01079: failed to make connection to backend: httpd-UDS [Sat Jan 05 23:01:42.293760 2019] [proxy:error] [pid 25976] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php7.2-fpm.sock (*) failed

That seems to be not a problem with the Ranksystem. That looks like your infrastructure (webserver, php, ...). First I get, when I google your error is something with Plesk. 1) Are you using Plesk? https://support.plesk.com/hc/en-us/articles/115001626829-PHP-FPM-website-is-not-accessible-on-Plesk-13-Permission-denied-AH02454-FCGI-attempt-to-connect-to-Unix-domain-socket

Cause you are saying, all other stuff on your website is working and it is only the Ranksystem site.. 2) This error happens only on the /webinterface/ or also at the /stats/ site? 3) Are you using a subdomain for the Ranksystem? 4) Could there be different configurations for the Ranksystem on your Apache / PHP against the rest of your website?

JoniVR commented 5 years ago

No, I’m not using Plesk. I already figured out it was the PHP service (see my last comment).

My rank system is just a subfolder in the root directory of the website. No seperate domain.

The problem was the PHP service acting up, which would explain why only the ranksystem wasn’t working because it’s the only part of the site that is using PHP and PHP has been a pain in the ass in general on the server.

It was the first time this happened and I’m wondering if it was just by accident or because I enabled the hashIP feature, but whatever, it’s fixed now.

Thanks for your time and the ranksystem in general, it’s a nice thing to have. I hope this can possibly help @javierlechuXD too.

Newcomer1989 commented 5 years ago

It was the first time this happened and I’m wondering if it was just by accident or because I enabled the hashIP feature, but whatever, it’s fixed now.

It shouldn't have to do with this feature. You can try to let it run for a couple of days. If all is working fine, you can try to activate this feature again. When the problem appears with changing this, please contact us again. If not (I am sure it is not), it was a problem with PHP. Perhaps due update, changing configuration or anything else.

Good to know, it is working for you. Its kinda hard to figure a problem out without have a direct access to the system ;-)

JoniVR commented 5 years ago

Just letting you know, it happend once more to me, it happened after restarting the server, so my guess is that the php7.2 service doesn't start autmatically in my case?

Because when I ran:

sudo service php7.2-fpm restart

again it was fixed

My guess is that it's a server specific issue in most cases (probably a php-fpm7.2 config issue), just documenting in case anyone else is running into this for the future.

Newcomer1989 commented 5 years ago

I think it is not fixed in your case. You should update your PHP to version 7.3. Inside PHP-FPM with version 7.2 is a bug. Cause the FPM is only for the frontend it doesn't consider the bot, but the stats page and the webinterface.