--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-23-2009, 08:31 PM
Daevid Vincent
/etc/cron.daily/apt hangs
On Mon, 2009-02-23 at 21:07 +0100, Markus Schönhaber wrote:
Daevid Vincent:
> If I try to run /etc/cron.daily/apt, it just hangs.
[...]
> stat64("/bin/sleep", {st_mode=S_IFREG|0755, st_size=26060, ...}) = 0
> clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|
> SIGCHLD, child_tidptr=0xb7e22908) = 16082
> wait4(-1,
Looks pretty normal to me. Among the first things the apt script does is to
sleep for a random amount of time.
So when I expect all my cron.daily tasks to be running at a given time in crontab, they're actually all delayed by some random amount. Since it's name is alphabetically earlier than anything else in the directory, this 'apt' holds up all the scripts below as they're not fired off in threads. *sigh*
If you check the process list, you'll probably see that there's a "sleep"
process that was started by the script - something that the above output from
strace also indicates.
I see that code:
# sleep for a random intervall of time (default 30min)
"The random sleep was added to avoid that the big archive servers/mirrors get hammered at exactly the same time when a lot of machines are switched on, e.g. 9:00 in the morning. '
Who "switches on" a Unix box??! They normally are running 24/7 right?
30 5 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
30 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
30 7 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
and modify the "apt" script to be:* RandomSleep=300
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-23-2009, 10:57 PM
Daevid Vincent
/etc/cron.daily/apt hangs
On Tue, 2009-02-24 at 00:18 +0100, Markus Schönhaber wrote:
Daevid Vincent:
> So when I expect all my cron.daily tasks to be running at a given time
> in crontab, they're actually all delayed by some random amount. Since
> it's name is alphabetically earlier than anything else in the directory,
> this 'apt' holds up all the scripts below as they're not fired off in
> threads. *sigh*
Hm, you're the first one I know of who expects jobs in cron.daily to be run
precisely at a given time.
I wouldn't say "precisely", however I don't expect some random delay which looks like a hung task to muck up things on me.
In my understanding jobs in cron.daily are to be
run once a day - whenever that may be throughout the day. And since those jobs
are executed sequentially, it's pretty obvious that any delay in one job (be
it caused by a sleep like in the apt script, a slow network or something else)
will affect the execution time of all following jobs.
True.
If I want something to be executed precisely at a given time, I create a real
cron job for it.
Again. True.
> "The random sleep was added to avoid that the big archive
> servers/mirrors get hammered at exactly the same time when a lot of
> machines are switched on, e.g. 9:00 in the morning. '
>
> Who "switches on" a Unix box??! They normally are running 24/7 right?
Interesting that you ask this question in an Ubuntu mailing list. Since IMO
Ubuntu's main success is based on the fact that it provides an easy to set up
*desktop* Linux.
I've been using Linux since it was Slackware on an Amiga 3000 and came on 14 floppies.
I've used RedHat, CentOS, Gentoo, and various others as my servers too.
To me, Ubuntu is just a "more supported" and "prettier UI" with less hassle version of Linux. In another few years, a new contender will come along that's even better I'm sure.
RedHat pissed me off with their dependency hell in RPMs years ago. And then the whole split to Fedora was messy at the time.
I switched to Gentoo, but I've grown VERY tired of re-compiling all the time when the H/W server died, I decided it was time to jump ship to Ubuntu Server (with the GUI added later) (ironic that now, my new Ubuntu server is 4 procs and 4GB RAM and could handle it very nicely I suspect).
And my guess would be that many of those desktops might get switched off in the
evening and switched back on in the morning. At least, this doesn't seem too
unrealistic a guess to me.
Switching off/on a desktop is so bad for the hardware. It's better to just leave them on. Especially any Unix flavor -- for exactly the reasons we're discussing here. Crontabs need to be run. Having them all "catchup" later (via anacron) is a kludge.
Moreover I think we can assume that the people operating the archive servers
know when the load is high and whether the load spikes form a pattern.
Fair enough.
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-23-2009, 11:52 PM
Derek Broughton
/etc/cron.daily/apt hangs
Markus Schönhaber wrote:
> Daevid Vincent:
>
> Hm, you're the first one I know of who expects jobs in cron.daily to be
> run precisely at a given time. In my understanding jobs in cron.daily are
> to be run once a day - whenever that may be throughout the day. And since
> those jobs are executed sequentially, it's pretty obvious that any delay
> in one job (be it caused by a sleep like in the apt script, a slow network
> or something else) will affect the execution time of all following jobs.
Hmmm. Not that obvious - I didn't think the cron jobs waited for one
another at all...
>
>> "The random sleep was added to avoid that the big archive
>> servers/mirrors get hammered at exactly the same time when a lot of
>> machines are switched on, e.g. 9:00 in the morning. '
>>
>> Who "switches on" a Unix box??! They normally are running 24/7 right?
Ack! I'm afraid you're mostly right, but what a ridiculous waste of energy.
> Interesting that you ask this question in an Ubuntu mailing list. Since
> IMO Ubuntu's main success is based on the fact that it provides an easy to
> set up *desktop* Linux.
> And my guess would be that many of those desktops might get switched off
> in the evening and switched back on in the morning. At least, this doesn't
> seem too unrealistic a guess to me.
Even knowing mostly geeks - the sort of people who might be expected to run
a machine 24/7, I don't know many people whose _personal_ machines run
full-time.
--
derek
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-24-2009, 12:32 AM
Rashkae
/etc/cron.daily/apt hangs
Derek Broughton wrote:
>
> Hmmm. Not that obvious - I didn't think the cron jobs waited for one
> another at all...
They don't. Cron.daily is, in fact, 1 cron job. (examine /etc/crontab
to see how it's done)
> Even knowing mostly geeks - the sort of people who might be expected to run
> a machine 24/7, I don't know many people whose _personal_ machines run
> full-time.
>
Huh, that's interesting.. I'll admit the that the reasons to keep a
machine running around the clock are mostly bogus, most geeks I know do
so anyhow.
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-24-2009, 12:34 AM
Markus Schönhaber
/etc/cron.daily/apt hangs
Derek Broughton:
> Markus Schönhaber wrote:
> > Hm, you're the first one I know of who expects jobs in cron.daily to be
> > run precisely at a given time. In my understanding jobs in cron.daily are
> > to be run once a day - whenever that may be throughout the day. And since
> > those jobs are executed sequentially, it's pretty obvious that any delay
> > in one job (be it caused by a sleep like in the apt script, a slow
> > network or something else) will affect the execution time of all
> > following jobs.
>
> Hmmm. Not that obvious - I didn't think the cron jobs waited for one
> another at all...
<nitpick_mode>
Strictly speaking, the cron jobs don't wait for each other, but rather there's
only one cron job involved - the one which starts run-parts. Which, in turn,
runs the scripts in the cron.daily directory, and does so one after the other.
</nitpick_mode>
Regards
mks
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-24-2009, 01:13 AM
Rashkae
/etc/cron.daily/apt hangs
Markus Schönhaber wrote:
>
> <nitpick_mode>
> Strictly speaking, the cron jobs don't wait for each other, but rather there's
> only one cron job involved - the one which starts run-parts. Which, in turn,
> runs the scripts in the cron.daily directory, and does so one after the other.
> </nitpick_mode>
>
> Regards
> mks
>
>
Details aside, I think we can reasonably agree that a random sleep
holding up the daily cron job is not really expected behaviour and this
can be tuned a little somehow,, (ex, put apt in it's own crantab file
instead of using cron.daily)
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-24-2009, 01:46 AM
Smoot Carl-Mitchell
/etc/cron.daily/apt hangs
On Mon, 2009-02-23 at 21:13 -0500, Rashkae wrote:
> Markus Schönhaber wrote:
> >
> > <nitpick_mode>
> > Strictly speaking, the cron jobs don't wait for each other, but rather there's
> > only one cron job involved - the one which starts run-parts. Which, in turn,
> > runs the scripts in the cron.daily directory, and does so one after the other.
> > </nitpick_mode>
> >
> > Regards
> > mks
> >
> >
>
> Details aside, I think we can reasonably agree that a random sleep
> holding up the daily cron job is not really expected behaviour and this
> can be tuned a little somehow,, (ex, put apt in it's own crantab file
> instead of using cron.daily)
You can always add the --new-session parameter and run-parts will then
run each job in a separate process. I'd experiment with this first,
since you could run the load average up pretty quickly for a short
duration. If you have enough memory and processing power, this is
probably pretty harmless.
--
Smoot Carl-Mitchell
Computer Systems and
Network Consultant
smoot@tic.com
+1 480 922 7313
cell: +1 602 421 9005
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-24-2009, 07:29 AM
Nils Kassube
/etc/cron.daily/apt hangs
Daevid Vincent wrote:
> Switching off/on a desktop is so bad for the hardware. It's better to
> just leave them on.
Can you explain what part of the hardware will be damaged from regular
switching on/off? I'm using computers at home for >20 years and I have
always switched them off when I'm not at home and during the night. I
don't think I had any harware fail within the first 5 years of their
life.
> Especially any Unix flavor -- for exactly the
> reasons we're discussing here. Crontabs need to be run. Having them all
> "catchup" later (via anacron) is a kludge.
IIRC, this desktop machine I am using right now needs about 70W. If I keep
it running over night only for a few cron jobs it would cost me an extra
40 €uro per year. Therefore I prefer the anacron kludge.
Nils
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
02-24-2009, 12:59 PM
Derek Broughton
/etc/cron.daily/apt hangs
Rashkae wrote:
> Derek Broughton wrote:
>
>>
>> Hmmm. Not that obvious - I didn't think the cron jobs waited for one
>> another at all...
>
> They don't. Cron.daily is, in fact, 1 cron job. (examine /etc/crontab
> to see how it's done)
Er, actually /etc/crontab runs run-parts - and I didn't think run-parts was
synchronous. Obviously my mistake - but I was just pointing out that it
wasn't entirely obvious even to somebody of my experience :-)
>> Even knowing mostly geeks - the sort of people who might be expected to
>> run a machine 24/7, I don't know many people whose _personal_ machines
>> run full-time.
>
> Huh, that's interesting.. I'll admit the that the reasons to keep a
> machine running around the clock are mostly bogus, most geeks I know do
> so anyhow.
Almost everybody I know these days uses a laptop as a primary system, and
while we never boot them, they aren't on all the time.
--
derek
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users