Web Hosting Talk







View Full Version : restarting httpd??


Lmax
10-10-2001, 08:21 AM
When i restart the httpd server it takes some time before sites are back up again. In the mean time i get an The page cannot be displayed error.
After about 5 minutes the sites are back online. But every thime i install/delete a client the server is 5 minutes down.
Also a strange thing, this doesn't happen every time, sometimes it just restarts fine. Rebooting the server also doesn't help.
The admserv is working fine.

I'm running an RAQ3 with apache 1.3.19

Please advice

Chicken
10-10-2001, 11:07 AM
Originally posted by Lmax
But every thime i install/delete a client the server is 5 minutes down.

Why are you restarting httpd everytime you are installing/deleting a client (not exactly sure what this means really???)

Lmax
10-10-2001, 11:11 AM
When a domain gets added the httpd.conf changes, then you have to restart httpd(or am i wrong)
Even if i don't have to restart, this morning the webserver stopped responding. The other servers(ftp, ssh) still worked fine. so i had to restart, again that problem.

When restarting i got this error :
[root@www /root]# /etc/rc.d/init.d/httpd restart
Shutting down Web Service: kill: (4661) - No such pid
httpd
Setting up Web Service: chiliasp: module started, version 3.6.0.33
/usr/sbin/httpd


Maybe it sounds familiar.

Thanks

allera
10-10-2001, 12:44 PM
Have you checked your error log file? Startup errors are reported there too. Also, try stopping the service, wait 10 seconds, and then start it rather than restarting. Restarting might try to start it too quickly before Apache gets a chance to "stop". This probably only applies to really heavily used Apaches though.

Chicken
10-10-2001, 01:09 PM
Originally posted by Lmax
When a domain gets added the httpd.conf changes, then you have to restart httpd(or am i wrong)
Even if i don't have to restart, this morning the webserver stopped responding. The other servers(ftp, ssh) still worked fine. so i had to restart, again that problem.

When restarting i got this error :
[root@www /root]# /etc/rc.d/init.d/httpd restart
Shutting down Web Service: kill: (4661) - No such pid
httpd
Setting up Web Service: chiliasp: module started, version 3.6.0.33
/usr/sbin/httpd

Well, unless you are manually changing the httpd.conf file, then you don't have to manually restart it. I'm not sure if that's what you are doing (?). Are you just adding sites through the admin GUI?

If the web server stops, then (as was said), you just have to start it, and the error seems to indicate only that the web server isn't running, server tried to kill it for a restart, then restarted. You should be concerned with why it stops in the first place, and I'm not sure why that would be happening (surely not one thing I could guess from what you posted).

Lmax
10-10-2001, 01:35 PM
The server went offline when it was log rotating.
This is the first message in the error log
[Wed Oct 10 04:11:20 2001] [notice] Apache/1.3.19 (Unix) mod_throttle/3.1.2 mod_gzip/1.3.19.1a PHP/4.0.4pl1 mod_perl/1.26 PHP/4.0.4pl1 mod_auth_pam/1.0a mod_ssl/2.8.3 OpenSSL/0.9.6b configured -- resuming normal operations

I also checked the rotated log file(error.1)
and this contained this error message at the end
[Wed Oct 10 04:06:11 2001] [error] mod_gzip: EMPTY FILE [/tmp/_20871_4117_4018.wrk] in sendfile2
[Wed Oct 10 04:06:11 2001] [error] mod_gzip: Make sure all named directories exist and have the correct permissions.
[Wed Oct 10 04:06:19 2001] [notice] SIGUSR1 received. Doing graceful restart
critical_acquire() failed: Invalid argument
critical_release() failed: Invalid argument


There is also a strange mod_gzip error appearing thoughout the error log. Something about file permissions, while the /home/tmp/ dir is chmoded 777

I also found this error in my logs without a timestamp before it.
sh: /usr/games/fortune: No such file or directory
What does this mean??

Any suggestions??

Lmax
10-10-2001, 02:10 PM
also is this normal?? Stopping it but it keeps on running??

[root@www httpd]# /etc/rc.d/init.d/httpd stop
Shutting down Web Service:
[root@www httpd]# /etc/rc.d/init.d/httpd status
httpd (pid 1219 1217 1215) is running...

and after trying to kill the processe manually and starting the servers again

[root@www httpd]# /etc/rc.d/init.d/httpd status
httpd dead but subsys locked

Chicken
10-10-2001, 10:27 PM
Ummm, no that sure doesn't seem normal. I'm not sure what would be causing this, if you installed something lately that conflicted with something, etc.

So web server is down (seems from your post), rebott won't bring it back up, hard reboot work?

CmptrWz
10-11-2001, 04:37 PM
To my understanding when you shut down httpd any process still in the middle of serving a file will not shut down right away. You just have to wait for everyone to disconnect from the server, and all the processes will go away.

Lmax
10-11-2001, 07:23 PM
So it's probably that when i restart the httpd server it just waits untill all files are transfered completely, and then it restarts. Seems reasonable.

But there is still the strange thing that when the server seems to hang and i do a hard reboot and the server comes online again it still takes a long time before the sites come online. Sometimes up to 5 minutes.
Restarting the httpd server sometimes helps and brings the server back up.
But if i do nothig it can take up to fice to ten minutes before the sites come up, even after a hard reboot, when no files are transfered

CmptrWz
10-11-2001, 09:24 PM
That is because it takes a few min for httpd to create all the instances of itself it needs to properly serve sites on your server.

jswift
10-12-2001, 10:32 PM
Why don't you use apachectl/httpdctl ??

# apachectl graceful

Lmax
10-14-2001, 06:44 AM
I think i solved the problem. I recompiled apache with php 4.0.6 in stead og php 4.0.4pl1
And it now runs fine for a day, i know this isn't much, but it's better then it was.

Also restarting with apachectl graceful works much better
using .../jttpd restart says the server restarted but often this isn't true. using apachectl graceful is really restarts. It may take some more time but it restarts

Lmax
10-27-2001, 03:43 PM
On a server with plesk on it i had the same problem. The problems seems to be the apache server wants to restart but there are still httpd processes running. For the plesk i got the solution mentioned below. How can i implement this on a RAQ so it waits till the processes that take a longer time are shut down properly. Maybe also automaticwlly killing processes when it takes to long, more then 2 minutes or so?!

Thanks

This was the solution for plesk -->>

To quickly solve this problem make the following:

add next functions to the /usr/local/psa/rc.d/httpd file:
__________________________________________________
______________________________

get_pids_byname()
{
proc_name="$1"
PIDS=`ps -axww | awk '$5 ~ "'$proc_name'$" {print $1}'`
echo $PIDS
}

wait_after_stop()
{
PIDS=`echo "$1" | tr ' ' ,`
count=${2:-50}
while [ 0$count -gt 0 ]
do
ps -p $PIDS > /dev/null 2>&1 || break
sleep 1
count=`expr $count - 1`
done
if [ 0$count -eq 0 ]; then
echo Remaining processes:
ps w -p $PIDS 2>/dev/null
return 1
fi
return 0
}
__________________________________________________
______________________________

The first function get PIDs for process
the second - wait while all processes with such PIDs are die.

also change the string for "sleep 2" between stop and start commands:
__________________________________________________
______________________________


...

if [ -x "$apachectl" ]; then

case "$action" in

restart)
"$apachectl" stop > /dev/null 2>&1
>>>>>>> #sleep 2
>>>>>>> wait_after_stop "`get_pids_byname psa/apache/bin/httpd`" 50
"$apachectl" start > /dev/null 2>&1 &&
rst "$service" || f_rst "$service"
;;

start)
"$apachectl" start > /dev/null 2>&1 &&
strt "$service" || f_strt "$service"
;;
....