Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 389965

Summary: www-servers/apache-2.2.21 restart initscript issue
Product: Gentoo Linux Reporter: Gerrit Helm <mail>
Component: Current packagesAssignee: Apache Team - Bugzilla Reports <apache-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: bes.internal, dustin, gbugs, gentoo, grimm26, Ikonta, jackhill, mirage, pva, slashbeast, tom
Priority: Normal    
Version: 10.0   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info
Diff for /etc/init.d/apache2
Diff for apach2.initd

Description Gerrit Helm 2011-11-09 14:04:58 UTC
Created attachment 292021 [details]
emerge --info

Hi,

apache2.2.21 got an issue in its latest init.d script regarding the restart function.

server ~ # /etc/init.d/apache2 restart
 * Caching service dependencies ...                          [ ok ]
 * Stopping apache2 ...                                      [ ok ]
 * Starting apache2 ...
 * start-stop-daemon: /usr/sbin/apache2 is already running   [ ok ]

It boils down to this line in the initscript:

/etc/init.d/apache2:
 78         start-stop-daemon --start -- ${APACHE2} ${APACHE2_OPTS} -k start

If I change it to '${APACHE2} ${APACHE2_OPTS} -k start' it works as expected.
Comment 1 Toei Rei 2011-11-17 06:41:24 UTC
confirmed. My workaround is stopping apache, waiting a second or two and then starting it...
Comment 2 Sok Ann Yap 2011-11-19 07:28:40 UTC
Created attachment 293073 [details, diff]
Diff for /etc/init.d/apache2

The while loop condition in stop() was wrong. The loop should continue as long as the PID file still exist, the apache2 PID is still running, and the timeout value hasn't been exceeded yet.
Comment 3 Marcel Partap 2011-11-22 19:20:19 UTC
(In reply to comment #2)
> Created attachment 293073 [details, diff] [details, diff]
> Diff for /etc/init.d/apache2
Excellent. WORKSFORMETHX ;)
Comment 4 Steve Dibb (RETIRED) gentoo-dev 2011-12-02 19:34:19 UTC
We also have a workaround in bug 388009, but I'm honestly not sure which one is best to apply.
Comment 5 Adrian 2012-01-14 18:52:02 UTC
That bug is there for months now and there's still no fix for it in portage..
Comment 6 Gerrit Helm 2012-01-14 19:34:28 UTC
The fix from Sok Ann Yap is definately the right one.
Hey Apache Maintainers, please apply the Patch to Portage!

Thank you..
Comment 7 Gerald 2012-02-11 17:34:10 UTC
The fix from Sok Ann Yap works perfectly and changes only a single line by 2 characters. Given this complexity, I guess we can expect to get this patch through QA by 2014 at the latest and into portage by 2017.
Comment 8 Gerrit Helm 2012-03-06 09:21:21 UTC
bump..
Comment 9 Tomas Hofman 2012-03-06 11:33:21 UTC
Yes, patch from Sok Ann Yap is working perfectly. Apache Maintainers, please apply it into Portage! I think you have enough time to prove it in last 4 months...
Comment 10 William Waisse 2012-03-11 14:48:41 UTC
same problem here, same fix, initscript not working is an important problem, should have been fixed very fast, problem still here 3 months later . . .
Comment 11 Dustin C. Hatch 2012-03-13 04:44:49 UTC
+1 Had this problem, removed the ! on line 105, problem solved...
Comment 12 Ronny Multrus 2012-03-16 09:22:50 UTC
(In reply to comment #2)
> Created attachment 293073 [details, diff] [details, diff]
> Diff for /etc/init.d/apache2

The patch works great, thank you!

Why can't this small change be applied to portage?
Comment 13 Dirkjan Ochtman (RETIRED) gentoo-dev 2012-03-19 16:27:58 UTC
*** Bug 396173 has been marked as a duplicate of this bug. ***
Comment 14 Dirkjan Ochtman (RETIRED) gentoo-dev 2012-03-19 16:28:48 UTC
pva/apache maintainers, could this please get fixed? It's pretty annoying. Or just +1 and I'll just commit the patch to all init scripts for you.
Comment 15 Patrick Lauer gentoo-dev 2012-03-28 15:05:38 UTC
+  28 Mar 2012; Patrick Lauer <patrick@gentoo.org> +apache-2.2.22.ebuild:
+  Bump for #401761. init script fix for #389965
Comment 16 Oleg Muraviov 2012-04-03 07:42:18 UTC
Created attachment 307589 [details, diff]
Diff for apach2.initd

Still getting this problem.
"test -f "${PIDFILE}" is false but "pgrep -P ${PID} apache2" still shows some apache processes.
I think it's better to use only "pgrep -P ${PID} apache2" as condition in init.d/apache2:105

Here is my diff