MRatWork Forum by Mustafa Ramadhan
Sawo Project - Kloxo-MR Discussions => Kloxo-MR Technical Helps => Topic started by: Anik on 2013-01-13, 00:43:58
-
Sometimes (not always) when i access my site i see errors like..
Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.
or
On Firefox:
Problem loading page
The connection to the server was reset while the page was loading.
on Chrome:
This webpage is not available
The connection to domain.com was interrupted.
Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.
any idea what is the reason of it?
-
is it something due to timeout?
i never saw it in opera.
-
It's because httpd is restarting in background. Mustafa should change restart to more graceful.
-
did you ever got this problem Marek? Is there any temporary fix?
-
did you ever got this problem Marek? Is there any temporary fix?
I always got it.
Modify restart line in /etc/init.d/httpd to:
restart)
$apachectl $@
RETVAL=$?
;;
-
I'm using php-fpm with nginxproxy. will this fix apply for this setup?
and now the config is something like
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible
# server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
# implementing the current HTTP standards.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
# When stopping httpd a delay of >10 second is required before SIGKILLing the
# httpd parent; this gives enough time for the httpd parent to SIGKILL any
# errant children.
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d 10 $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=$?
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
fi
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
# MR -- back to original because gracefull have a trouble with 2.2.23 version
#$apachectl configtest
#echo -e $"Gracefully restarting"
#$apachectl graceful
#status $httpd
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
force-reload|reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
RETVAL=3
esac
exit $RETVAL
should i delete them all and put just this following 4 lines as you said?
restart)
$apachectl $@
RETVAL=$?
;;
-
No just replace this:
restart)
stop
start
-
after doing this apache failed to start and all my websites is now completely down. :(
I used this config
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible
# server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
# implementing the current HTTP standards.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
# When stopping httpd a delay of >10 second is required before SIGKILLing the
# httpd parent; this gives enough time for the httpd parent to SIGKILL any
# errant children.
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d 10 $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=$?
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
fi
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
$apachectl $@
RETVAL=$?
# MR -- back to original because gracefull have a trouble with 2.2.23 version
#$apachectl configtest
#echo -e $"Gracefully restarting"
#$apachectl graceful
#status $httpd
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
force-reload|reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
RETVAL=3
esac
exit $RETVAL
is anything i missed out?
-
just fixed it. reason was some permission error.
-
but that above config didn't worked. apache isn't starting.
-
can you post here the exact config file which will work Marek?
-
Your are missing:
;;
before
# MR -- back to original because gracefull have a trouble with 2.2.23 version
-
tried that too before but failed
also there is already ;;
restart)
$apachectl $@
RETVAL=$?
# MR -- back to original because gracefull have a trouble with 2.2.23 version
#$apachectl configtest
#echo -e $"Gracefully restarting"
#$apachectl graceful
#status $httpd
;;
-
those lines are commented out so at the end of them theres already a ;;
-
Look inside '/usr/local/lxlabs/kloxo/httpdocs/htmllib/lib/lxserverlib.php' in 'function checkRestart()'
...
default:
exec_with_all_closed("/etc/init.d/$cmd restart");
...
How about if change to:
...
default:
// exec_with_all_closed("/etc/init.d/$cmd restart");
if (exec("service $cmd status | grep 'is running'")) {
exec_with_all_closed("/etc/init.d/$cmd reload");
} else {
exec_with_all_closed("/etc/init.d/$cmd restart");
}
...
It's mean if service status as 'running' just 'reload' and but if not running will be 'restart'
-
Here's my config:
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible
# server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
# implementing the current HTTP standards.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
# When stopping httpd a delay of >10 second is required before SIGKILLing the
# httpd parent; this gives enough time for the httpd parent to SIGKILL any
# errant children.
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d 10 $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=$?
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
fi
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
$apachectl $@
RETVAL=$?
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
force-reload|reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
RETVAL=3
esac
exit $RETVAL
-
now theres 2. should i apply both fixes? : :
-
now theres 2. should i apply both fixes? : :
No just replace your /etc/init.d/httpd with the last one.
-
ok i replaced with Marek's config. but if i don't apply Mustafa's fix then he will be angry -> :evil:
so tellme Mustafa, should i apply yours too? :D
-
another point i want to mention. my php-fpm expires after some times. maybe 24 hours or less. so i have to restart it periodically.
is it related to this matter?
-
I hope you can try my modification.
I think, changing option on 'switch applications' and 'webserver configs' need restart service, but add/modified/delete domains (it's related to service configs) don't need restart service. Just enough reload.
If this modification running well, final release will be use this modification.
-
No, no, no !
Reload won't add new domains etc.
It must be graceful !
"A reload is not sufficient as it does not reload the SSL certificates if there are changes there. Any new VirtualHosts, new domain, new subdoman, etc.. (even if they use the same certs) require a new read of the certs, and reload doesn't do this.
A restart is required... however, the graceful restart, mentioned above, can do a full restart without interruption of current connections."
-
So guys, there is now two modification. with which i should stick with?
Marek, did you ever got that connection reset problem in browser after applying your graceful restart fix on your own server?
Mustafa, you can try Marek's fix if he is certain that this problem won't happen again.
I am now watching the server and will update with further information, because this problem do not occurs always.
-
So guys, there is now two modification. with which i should stick with?
Marek, did you ever got that connection reset problem in browser after applying your graceful restart fix on your own server?
Mustafa, you can try Marek's fix if he is certain that this problem won't happen again.
I am now watching the server and will update with further information, because this problem do not occurs always.
I know about proposal. But, I don't like this approach where with this approach to modified init config file.
As we know, some services have 'restart', 'reload' and 'graceful'. But 'graceful' not always exists.
I have a plan (I hope implementing on next release), when Kloxo 'restart' (that mean running createRestart) certain service (say it, httpd) then Kloxo process this depend on 'restart' type ( 'restart', 'reload', 'graceful' or others) form 'listing' file.
-
Marek, did you ever got that connection reset problem in browser after applying your graceful restart fix on your own server?
Almost never. Only 0,03% connections to my Varnish failed (probably due to some kernel swapping error):
client_conn 1383757 16.23 Client connections accepted
client_drop 0 0.00 Connection dropped, no sess/wrk
client_req 3174663 37.24 Client requests received
cache_hit 365940 4.29 Cache hits
cache_hitpass 45 0.00 Cache hits for pass
cache_miss 2706253 31.74 Cache misses
backend_conn 188075 2.21 Backend conn. success
backend_unhealthy 0 0.00 Backend conn. not attempted
backend_busy 0 0.00 Backend conn. too many
backend_fail 2459 0.03 Backend conn. failures
backend_reuse 2807769 32.93 Backend conn. reuses
backend_toolate 100708 1.18 Backend conn. was closed
backend_recycle 2908890 34.12 Backend conn. recycles
backend_retry 635 0.01 Backend conn. retry
-
I have a plan (I hope implementing on next release),
So should we wait for the next release? is upgrading from the current release will be okay? before i got some serious problem for which i need to reinstall everything, so now i fear to upgrade. :|
backend_unhealthy 0 0.00 Backend conn. not attempted
backend_busy 0 0.00 Backend conn. too many
backend_fail 2459 0.03 Backend conn. failures
backend_reuse 2807769 32.93 Backend conn. reuses
backend_toolate 100708 1.18 Backend conn. was closed
where you get this stat?
-
Create varnish.php and put this inside the file:
<?php
// ==============================
// Server Uptime And Hardware Information |
// ==============================
?>
<html>
<head>
<title><?php echo $SERVER_NAME; ?> - Varnish Stat</title>
<STYLE type=text/css>
BODY { FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana,arial, helvetica, serif; margin : 0 0 0 0;}
</STYLE>
</head>
<body>
<pre>
<?php system("varnishstat -1"); ?>
</pre>
-
Or ssh varnishstat -1
-
Failed. PHP returned a WSOD
ssh varnishstat: command not found
should i need to install varnishstat via yum?
-
Failed. PHP returned a WSOD
ssh varnishstat: command not found
should i need to install varnishstat via yum?
Yes
-
Update about connection reset problem.
Just saw it once in chrome. Should i now apply Mustafa's fix too with Marek's config?
-
Update about connection reset problem.
Just saw it once in chrome. Should i now apply Mustafa's fix too with Marek's config?
My kernel 3.0.57 is still crashing with httpd and sometimes curl.
I will update to Kloxo-MR and this won't fix my issues I will update to 3.0.59.
-
so what do you recommend?
-
so what do you recommend?
Test my fix
-
yes i am using your fix Marek (your httpd config file) but it recenly gave 2 connection reset error.
-
seen 4 more errors.