Took too long to respond errors on several sites

Diggster

Member
Oct 27, 2015
9
0
1
edmonton
cPanel Access Level
Root Administrator
I have come across a strange problem - If anyone has any insight please point me in the right direction.

Half the sites on the server connect no problem. Another half result with "took too long to respond". It is not a local issue as proxying the sites has same results.

The question is Why some sites and not others? Research all says to flush DNS and restart the computer, routers, etc. Have done all that.

CSF is not installed - have never touched iptables - why might this start happening?
 

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
806
156
168
New Jersey
cPanel Access Level
DataCenter Provider
Can you ensure they are resolving to your server, this way you can rule out that the issue may be else where.

Are the sites similar, all running WordPress for example? Use similar plugins? You can try renaming the plugins folder to anything else, and clearing any cache in the wp-content/cache/ folder then try hitting the site again, does it time out?

Obviously if its not WP, that doesn't apply, but are they PHP based? If so, you can try hitting the site, then use

Code:
ps aux |grep php |grep user
find the PHP process for that user / script

and run

Code:
lsof -p $pid
replace $pid with the pid # of that process.

You have to run lsof before it times out, then check the output and look for any network related connections, this might help you narrow down an issue with a script trying to connect to an external resource that is down and causing the timeout.
 

Diggster

Member
Oct 27, 2015
9
0
1
edmonton
cPanel Access Level
Root Administrator
Thanks, jcats

The sites are all PHP - some WordPress and some custom cms. at least 30 of the 70 sites are affected. It does not seem platform specific. The sites always time out. I also stopped the iptable service.

I am a bit of a newbie - ran the commands as below - should I be running them in the site directories?

[email protected] [~]# ps aux |grep php |grep user
[email protected] [~]# lsof -p $pid
lsof: no process ID specified
lsof 4.82
latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
usage: [-?abhlnNoOPRtUvVX] [+|-c c] [+|-d s] [+D D] [+|-f[gG]] [+|-e s]
[-F [f]] [-g ] [-i ] [+|-L [l]] [+m [m]] [+|-M] [-o [o]] [-p s]
[+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]
Use the ``-h'' option to get more help information.
[email protected] [~]# [email protected] [~]# ps aux |grep php |grep user
 

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
806
156
168
New Jersey
cPanel Access Level
DataCenter Provider
No so, replace user with the cPanel username example

if the username is bob do:

Code:
ps aux |grep php | grep bob
this will print out all php processes, example:

Code:
[[email protected] public_html]# ps aux|grep php |grep bob
bob+ 1053059  0.0  0.0 280704 14108 ?        S    14:17   0:00 lsphp
bob+ 1054931 43.0  0.1 315416 44556 ?        Rs   14:20   0:00 lsphp:/home/bob/public_html/index.php
so in this case, I would run:

Code:
lsof -p 1054931
It will print out a bunch of stuff, but primarily look for rows that contain TCP in them which may help find the cause.
 

Diggster

Member
Oct 27, 2015
9
0
1
edmonton
cPanel Access Level
Root Administrator
I did that - at the root and received the following:


root 25563 0.0 0.0 7612 804 pts/0 S+ 17:43 0:00 grep php

then ran

lsof -p 25563

and it came up with nothing just return to command prompt
 

Jcats

Well-Known Member
PartnerNOC
May 25, 2011
806
156
168
New Jersey
cPanel Access Level
DataCenter Provider
you shouldn't have php processes running as root, the process that shows is the grep command you just ran. Its best to paste the entire output including the command you ran.

Make sure you are using the cPanel username of the account you are testing on in your browser. To find the cPanel username, in ssh you can type:

Code:
/scripts/whoowns domain.com
making sure to replace domain.com with the domain timing out. Then the username that shows you would replace with

Code:
ps aux |grep php | grep $user
Making sure to replace $user with the actual username from the out of the /scripts/whoowns script.

Recall, you have to run the 'ps' command while your browser is trying to reach the domain, but before it times out.

This might be difficult to assist with over a forum as you need a better understanding of ssh.

What if you:

Code:
tail -f /etc/apache2/logs/error_log
that will tail the log file in real time with any new lines as they are being logged. So while you tail that log, reproduce the timeout issue, then check the logs for any relevant errors. You can paste them here as well.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,272
313
Houston
Hi @Diggster

What @Jcats has requested is precisely what we would have asked you to request as well so we are waiting on that output to assist you further. I should point out that if you're unsure how to perform any of those tasks you might want to contact your provider or a system administrator if your provider is unable to assist. If you don't have a system administrator you might find one here: Resources | cPanel Forums

Thanks!