Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 396173 - www-servers/apache: restart/stop always fails in some conditions
Summary: www-servers/apache: restart/stop always fails in some conditions
Status: RESOLVED DUPLICATE of bug 389965
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Peter Volkov (RETIRED)
URL:
Whiteboard:
Keywords:
: 405243 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-12-27 07:51 UTC by Sergey S. Starikoff
Modified: 2012-03-19 16:27 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey S. Starikoff 2011-12-27 07:51:45 UTC
On my workstation I use for test purposes web-server (www-servers/apache-2.2.21-r1), which starts automatically.

The issue appears when I need to update its configuration: manual restart after auto-start of httpd daemon fails (after manual start it works fine).
The issue:
# /etc/init.d/apache2 restart
 * Caching service dependencies ...                                       [ ok ]
 * Stopping apache2 ...                                                   [ ok ]
 * Starting apache2 ...
 * start-stop-daemon: /usr/sbin/apache2 is already running                [ ok ]

First time manual restart (daemon not started):
# /etc/init.d/apache2 restart
 * apache2 not running (no pid file)
 * Starting apache2 ...                                                   [ ok ]

Second time manual restart (the daemon was started manually):
# /etc/init.d/apache2 restart
 * Stopping apache2 ...                                                   [ ok ]
 * Starting apache2 ...                                                   [ ok ]
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-12-27 08:10:44 UTC
How are you auto-restarting apache?
Comment 2 Sergey S. Starikoff 2011-12-27 09:59:42 UTC
(In reply to comment #1)
> How are you auto-restarting apache?

Automatically it's done by openrc during startup and shutdown.

Manually:
1. get root shell (su -).
2. And execute from it the command:
/etc/init.d/apache2 restart

After today's system update (yesterday's portage snapshot), sys-apps/busybox was updated, the issue seems to go away.
But I need a time to check.
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-12-27 20:13:34 UTC
Why do you say it's failing then?

All of your output in the initial bug comment has it starting fine.

Manually is doing it outside of the init script.
Comment 4 Sergey S. Starikoff 2011-12-28 05:40:47 UTC
(In reply to comment #3)
> Why do you say it's failing then?
> 
> All of your output in the initial bug comment has it starting fine.
> 
> Manually is doing it outside of the init script.

Today I've rechecked issue.
The bug was reproduced.

Initially (during boot process) apache is started by openrc:
# rc-update show | grep apache
              apache2 |      default 

When I need to update already autostarted apache configuration, I have to restart it manually:
# /etc/init.d/apache2 restart
 * Stopping apache2 ...                                                   [ ok ]
 * Starting apache2 ...
 * start-stop-daemon: /usr/sbin/apache2 is already running                [ ok ]

(last string contains error message, after executing listed command the web-server is actually down)

Next manual restart produces the following output:
# /etc/init.d/apache2 restart
 * apache2 not running (no pid file)
 * Starting apache2 ...                                                   [ ok ]

And all later _manual_ restarts of web server work as they should.
Comment 5 Christian Ruppert (idl0r) gentoo-dev 2011-12-28 15:00:05 UTC
This is not a OpenRC bug, see also bug 383093.

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

# /etc/init.d/apache2 restart
 * apache2 not running (no pid file)
 * Starting apache2 ...
Comment 6 Sergey S. Starikoff 2011-12-29 07:11:33 UTC
(In reply to comment #5)
> This is not a OpenRC bug, see also bug 383093.
> 
In my case it is test web-server for localhost-only on workstation (so it couldn't be heavy-loaded).

Yesterday I've find another example, where _first_ restart of apache web-server fails:
I use apache together with mod_php5.
After _some_ changes in php.ini (mentioned turning on syslog logging facility) _first_ restart fails (second and following works OK).
Comment 7 Christian Ruppert (idl0r) gentoo-dev 2012-01-14 20:50:06 UTC
bittern ~ # /etc/init.d/apache2 restart
 * Stopping apache2 ... [ ok ]
 * Starting apache2 ...
 * start-stop-daemon: /usr/sbin/apache2 is already running [ ok ]
bittern ~ # /etc/init.d/apache2 stop
 * apache2 not running (no pid file)
bittern ~ # ps aux|grep apache
root     27213  0.0  0.0   8076   616 pts/0    S+   20:16   0:00 grep --colour=auto apache
bittern ~ # /etc/init.d/apache2 start
 * Starting apache2 ...
Comment 8 Christian Ruppert (idl0r) gentoo-dev 2012-02-22 14:41:25 UTC
*** Bug 405243 has been marked as a duplicate of this bug. ***
Comment 9 Tomas Hofman 2012-03-06 11:10:06 UTC
I think that this bug can be related to Bug 389965.
Comment 10 Toralf Förster gentoo-dev 2012-03-06 15:15:56 UTC
(In reply to comment #9)
> I think that this bug can be related to Bug 389965.

confirmed, this change solved the  issue :

-	while ( ! test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) \
+	while ( test -f "${PIDFILE}" && pgrep -P ${PID} apache2 >/dev/null ) \
Comment 11 Dirkjan Ochtman (RETIRED) gentoo-dev 2012-03-19 16:27:58 UTC

*** This bug has been marked as a duplicate of bug 389965 ***