I'm often getting such messages when trying to restart apache: # /etc/init.d/apache2 restart * Stopping apache2 ... [ ok ] * Starting apache2 ... * start-stop-daemon: /usr/sbin/apache2 is already running [ ok ] Ok, once again: # /etc/init.d/apache2 restart * apache2 not running (no pid file) * Starting apache2 ... And i'm getting console after TIMEOUT seconds. Apache is working at this moment. I suspect problem appears when apache is working some time, and doesn't quit immediatelly. Reproducible: Sometimes
Thank you for report, Marcin. Probably I see the reason... Could you check that init script on your system has the code: i=0 while ( ! test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) \ && [ $i -lt ${TIMEOUT} ]; do sleep 1 && i=$(expr $i + 1) done eend $(test $i -lt ${TIMEOUT}) I guess we need to modify while ( ! test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) \ into while ( ! test -f "${PIDFILE}" || pgrep -P ${PID} apache2 >/dev/null ) \ ... at least this is what was supposed. BTW what MPM do you use?
I'm using prefork MPM. I did one test, works better (aka apache was restarted without problem). Please give me a couple of days to do more tests.
It looks init scripts do its job correctly.
I'm having similar problems, with the worker MPM; it's a pretty annoying regression.
(In reply to comment #1) > Thank you for report, Marcin. Probably I see the reason... > > Could you check that init script on your system has the code: > > i=0 > while ( ! test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) > \ > && [ $i -lt ${TIMEOUT} ]; do > sleep 1 && i=$(expr $i + 1) > done > > eend $(test $i -lt ${TIMEOUT}) > > I guess we need to modify > while ( ! test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) \ > into > while ( ! test -f "${PIDFILE}" || pgrep -P ${PID} apache2 >/dev/null ) \ > ... at least this is what was supposed. BTW what MPM do you use? The change outlined above worked for me!
I'm having the same problem with the init script. Although 2.2.21 used deprecated calls, apache restart worked fine but it no longer restarts properly with 2.2.21-r1. This is a regression.
(In reply to comment #1) > I guess we need to modify > while ( ! test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) \ > into > while ( ! test -f "${PIDFILE}" || pgrep -P ${PID} apache2 >/dev/null ) \ > ... at least this is what was supposed. BTW what MPM do you use? The switch to logical OR worked for me as well. I use worker MPM.
The "||-fix" worked for me, too. I'm using the itk MPM.
The fix (&& -> ||) works fine. Can you please fix it?
I beg to differ. The switch to logical OR works, but waits until ${TIMEOUT} seconds before restarting. I don't think that's a solution. If I'm wrong please correct me, but some changes in bug 389965 might work better.
Ping.
Hmm, apache isn't rarely using soft, what is the reason of such huge delay with rather simple fix?
+ 28 Mar 2012; Patrick Lauer <patrick@gentoo.org> +apache-2.2.22.ebuild: + Bump for #401761. init script fix for #389965
Thanks.
For me only this works : while ( ! test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null )
(In reply to comment #15) > For me only this works : > > while ( ! test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) The fix (https://bugs.gentoo.org/attachment.cgi?id=293073&action=diff) in #389965 was tested on several machines with no problems so far. Did you already try it?
Should be fixed now, reopen if you still can make it fail
It looks it still somethings is going bad: # /etc/init.d/apache2 restart * Caching service dependencies ... [ ok ] * Stopping apache2 ... [ ok ] * Starting apache2 ... * start-stop-daemon: /usr/sbin/apache2 is already running [ ok ]
Have the same problem here, with www-servers/apache-2.2.22-r1 hostname ~ # /etc/init.d/apache2 restart * Caching service dependencies ... [ ok ] * Stopping apache2 ... [ ok ] * Starting apache2 ... * start-stop-daemon: /usr/sbin/apache2 is already running [ ok ] => after the "restart" the server isn't running
I confirm (In reply to comment #19) > Have the same problem here, with www-servers/apache-2.2.22-r1 > > > hostname ~ # /etc/init.d/apache2 restart > * Caching service dependencies ... > [ ok ] > * Stopping apache2 ... > [ ok ] > * Starting apache2 ... > * start-stop-daemon: /usr/sbin/apache2 is already running > [ ok ] > > => after the "restart" the server isn't running I'm running the same version apache-2.2.22-r1 on x86-64. I have tried to unmerge apache, apr, apr-util (following Gentoo Apache Troubleshooting Guide[1]), purge all of the configuration files and remerge them again but nothing changed. Even worse, there is process Apache running on the background, using ~100% CPU, with no PID in /var/run/, and not responding to `apache2ctl describe fullstatus`. [1] http://www.gentoo.org/proj/en/apache/doc/troubleshooting.xml
Did you run: # dispatch-conf
(In reply to comment #21) > Did you run: > # dispatch-conf I used `cfg-update -u` instead. Anyway, althought I don't understand entirely, I discovered the cause of my problem. Whenever I started Apache, I always received the warning: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName I tried adding `ServerName localhost` to httpd.conf, the warning was no longer there and Apache CPU usage dramatically dropped to normal. However, still no response with `curl localhost`. Tracking Apache error log gave me the following error: /usr/sbin/apache2: symbol lookup error: /lib64/libnss_compat.so.2: undefined symbol: sysconf, version GLIBC_2.2.5 Which made me remember that I recently switched to Gold from GNU Linker and updated the system several times, recompiling Apache one. After rebuilding gcc, glibc, apr, apr-util, apache, php and some mod depend on them, now it works again. My apologies for the false alarm and irrelevant comments.
This bug has turned into a user support forum. If 2.2.23 or newer fails, please open a new bug and ensure you are not using the gold linker or other experimental gadgetry.