APT daily cronjobs hangs, prevents other cronjobs to be executed

Bug #246381 reported by Yann Hamon on 2008-07-07
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Medium
Unassigned

Bug Description

Hi,

I've created a cronjob in /etc/cron.daily (a very simple mysqldump) and have been looking for weeks why it wouldnt execute... Following the advice of a friend I run:

sudo su -
run-parts --report /etc/cron.daily

Which seemed to hang completely. I straced the process, and it seemed it was hanging on the APT cron job;
access("/etc/cron.daily/apt", X_OK) = 0
pipe([3, 4]) = 0
pipe([5, 6]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7db86f8) = 13861
close(4) = 0
close(6) = 0
select(6, [3 5], NULL, NULL, NULL

I removed the APT cronjob and now the run-parts works fine... would be worth testing but I wonder if all the cronjobs following /etc/cron.daily/apt are executed properly...

Maybe this bug is linked to https://bugs.launchpad.net/ubuntu/+source/apt/+bug/86896 ?
I am using Jeos 8.04 built with uvb - tell me if I can provide any additional information, thanks!

Eric (ericcart) wrote :

I had the same problem. To solve it, I narrowed the search to the function random_sleep...... It sleeps....... 30 min????

# sleep for a random intervall of time (default 30min)
# (some code taken from cron-apt, thanks)
random_sleep()
{
    RandomSleep=1800
    eval $(apt-config shell RandomSleep APT::Periodic::RandomSleep)
    if [ $RandomSleep -eq 0 ]; then
 return
    fi
    if [ -z "$RANDOM" ] ; then
        # A fix for shells that do not have this bash feature.
 RANDOM=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c"1-5")
    fi
    TIME=$(($RANDOM % $RandomSleep))
    sleep $TIME
}

Very odd, I just commented it at apt, line 222, and It's working again.

Eric (ericcart) wrote :

Also, remember to have anacron enabled.

I've disabled it thinking it has no usage.

Loïc Minier (lool) wrote :

The APT cron job has a random delay to avoid having many thousands of machines hitting mirrors at the very same time.

Perhaps we should rename it zzz-apt as to not delay the other jobs randomly? or we could use /etc/cron.d instead of cron.daily.

As a workaround, you can move /etc/cron.daily/apt to /etc/apt-daily-cron and add an entry in /etc/crontab such as:
25 6 * * root /etc/apt-daily-cron

Changed in apt (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
status: Confirmed → Triaged
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt - 1.2.10

---------------
apt (1.2.10) unstable; urgency=medium

  [ Zhou Mo ]
  * zh_CN.po: update simplified Chinese translation. (100%)

  [ Julian Andres Klode ]
  * test-apt-download-progress: Use a larger file for testing
  * Allow lowering trust level of a hash via config

  [ Michael Vogt ]
  * Use systemd.timer instead of a cron job (Closes: #600262, #709675, #663290)
    (LP: #246381, #727685)

  [ David Kalnischkies ]
  * use buffered writing for InRelease splitting

  [ Takuma Yamada ]
  * Japanese program translation update (Closes: 819938)

 -- Michael Vogt <email address hidden> Tue, 05 Apr 2016 20:23:47 +0200

Changed in apt (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers