services restarted from anacron have nice level of 10

Bug #19797 reported by Rui Matos
Affects Status Importance Assigned to Milestone
anacron (Ubuntu)
apache2 (Ubuntu)
Won't Fix
Soren Hansen

Bug Description

When logrotate runs, it restarts apache. But the nice level of the web server is
then set to 10. I guess this is not the expected behaviour because when apache
is started after a reboot its nice level is 0.

I guess changing the restart line of /etc/logrotate.d/apache2 to

nice -n 0 /etc/init.d/apache2 restart > /dev/null

is the right thing to do.

Revision history for this message
Adam Conrad (adconrad) wrote :

There is nothing in the apache2 packaging which would be restarting the daemon
with nice -n 10. Did you locally change your /etc/cron.dail/logrotate to run
logrotate with a nice level of 10, perhaps, thus making anything logrotate
restarts also run at 10? I can't think of any other ways off the top of my head
that this could happen, though I'm sure there are some. Having every daemon
that logrotate restarts explicitly set its nice level doesn't seem like the
right answer, though.

Revision history for this message
Rui Matos (tiagomatos) wrote :

I haven't changed anything locally regarding anacron, cron or logrotate. The
problem is that in /etc/anacrontab you can see that everything runs under nice,

1 5 cron.daily nice run-parts --report /etc/cron.daily

Thus logrotate will run with a nice level of 10.

Maybe I shouldn't have assigned this bug to the apache packages. Yet I don't
know where to file this either because it seems sane that the cron jobs launched
by anacron don't hog the system yet the daemons that get restarted should keep
their initial nice level.

Revision history for this message
Adam Conrad (adconrad) wrote :

Hrm. Okay, I see that now. I don't (ever) have anacron installed on servers,
so the interaction between anacron and logrotate didn't really occur to me. One
could perhaps make an argument that invoke-rc.d should reset the nice level
before firing init scripts (of course, that hilights a bug that apache2 doesn't
use invoke-rc.d in its logrotate snippet, but that's easy enough to fix). I'll
discuss the invoke-rc.d/nice with a few others and see where that lands us.

(For now, there's no harm in you manually mangling the logrotate files, they are
conffiles, so won't be overwritten on upgrade without prompting)

Revision history for this message
Adam Conrad (adconrad) wrote :

As a side note, one could also make the argument that anything started from
anacron, being an application squarely aimed at desktop users, is better off
being nice'd anyway, since if I have apache2 installed on my laptop, I probably
don't much care if it has the CPUs full attention. :)

Revision history for this message
Someone (s4910321931-deactivatedaccount) wrote :

Now we have ubuntu server edition and comment by Adam Conrad is no longer valid. What is the status of the bug?

Soren Hansen (soren)
Changed in apache2:
assignee: adconrad → shawarma
Revision history for this message
Rolf Leggewie (r0lf) wrote :

I have certainly seen this bug. I hope to get rid of it by deinstalling anacron which is not necessary for my 24/7 server.

I am not sure if this better be fixed in apache or anacron. Both would be possible. Confirming.

Changed in apache2:
status: Unconfirmed → Confirmed
Changed in anacron:
importance: Undecided → Low
status: Unconfirmed → Confirmed
Revision history for this message
Soren Hansen (soren) wrote :

For the server version of Ubuntu, this bug is completely irrelevant as it does not install anacron by default, but rather uses a proper cron.

I'm also very much incined to reject this bug, as I agree with Adam's remark that keeping it at a nice level of 10 on a system that uses anacron does not constitute much of an issue.

Changed in apache2:
importance: Low → Wishlist
Changed in anacron:
importance: Low → Wishlist
Mathias Gug (mathiaz)
Changed in apache2:
status: Confirmed → Won't Fix
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

The "correct" fix for this is to migrate to Upstart, which always starts services with the nice level defined in their conf file, not one inherited from the environment

summary: - apache is restarted with nice level of 10
+ services restarted from anacron have nice level of 10
Changed in anacron (Ubuntu):
status: Confirmed → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.