Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Apache died this morning... why?
Date: Tue, 31 Dec 2013 10:57:59
Message-Id: 52C2A316.8040901@gmail.com
In Reply to: Re: [gentoo-user] Apache died this morning... why? by Tanstaafl
1 On 30/12/2013 15:44, Tanstaafl wrote:
2 >>> This happened by the way when the logs were rotated by logrotate. Maybe
3 >>> that is significant?
4 >>
5 >> Yes, that is highly significant.
6 >>
7 >> IIRC logrotate can work in one of two ways:
8 >>
9 >> 1. rename the log file and create a new empty one
10 >> 2. copy the log file elsewhere and truncate the original
11 >>
12 >> I forget which way it does it for the moment...
13 >>
14 >> #1 is fast but leaves the daemon (apache or syslog) trying to write to a
15 >> file that isn't there anymore. Or worse, it's writing to an open file
16 >> that has been deleted and a new one with the same name still exists.
17 >> #2 is slower but safer.
18 >>
19 >> Either way, the apache daemon has to be told it's log file went away.
20 >> Not all daemons can use inotify to just find this out, some have to be
21 >> told, so logrotate resets/restarts/hups them. In the case of apache it
22 >> does a graceful restart (what you get with apachectl graceful).
23 >>
24 >> Your apache re-read it's config file at that point, found any error for
25 >> php and decided to roll over and die.
26 >
27 > Ok, but, if that is the case, why did it startup just fine when I simply
28 > did /etc/init.d/apache2 start? Shouldn't it have still died?
29
30
31 Logically, one would assume so. But that's not the full picture, many
32 other things could have happened in the interim. Portage could have been
33 busy with preserved libs in the background, later emerges could have
34 fixed some issue. Or maybe Apache was having a bad day.
35
36 These things happen, no use wondering about them, especially if they are
37 not reproducible. Instead:
38
39 /etc/init.d/apache2 start
40 apachectl graceful
41 apachectl reload
42
43 and check those commands do what they ought to. If so, shrug and get on
44 with real life. Not everything that happens on a computer is worth
45 spending brain cycles on, and not everything has a reason you can figure
46 out.
47
48 --
49 Alan McKinnon
50 alan.mckinnon@×××××.com

Replies

Subject Author
Re: [gentoo-user] Apache died this morning... why? Tanstaafl <tanstaafl@×××××××××××.org>