apt-cacher continues to download index files even if disk is full, wasting bandwidth

Bug #291748 reported by Peter Matulis
22
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apt-cacher (Debian)
Fix Released
Unknown
apt-cacher (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: apt-cacher

The problem:

When a client machine attempts an update (typically automatically) apt-cacher continues to download index files ('Release' and 'Packages') even if the disk/partition is full, thus wasting bandwidth. Given that apt-cacher is usually implemented to save bandwidth this behaviour should be changed.

Expected behaviour:

When deprived of space apt-cacher should cease to download files and display an appropriate message to the client.

Version affected (at least):

apt-cacher 1.5.5

Revision history for this message
Etienne Goyer (etienne-goyer-outlands) wrote :

Tested on Jaunty with apt-cacher version 1.6.7ubuntu2, and the behavior is more or less the same.

Basically, when a client request an index file, apt-cacher will start to download it, and pass it through to the client as it trickle in. Eventually, it will fail to write to disk and close the connection to the client abruptly. apt on the client will retry the download indefinitely.

The problem is really two-fold.

On one hand, apt-cacher should indeed handle running out of disk space gracefully. That would require non-trivial code change to apt-cacher. It could, for example, refuse to download a file if there is less than a certain amount of space left on the file system its cache is stored on, and return HTTP 500 Internal Error.

On the other hand, the problem is exacerbated by apt on the client retrying the download forever. There is no way to change this behavior (see Debian bug #119544, and LP #310262). If apt could be configured to limit the number of time it retries fetching an index file, the problem would at least be mitigated.

Revision history for this message
Etienne Goyer (etienne-goyer-outlands) wrote :

This debdiff against apt-cacher 1.5.5 propose a solution to this problem. Basically, it return "503 Cache Full" if it needs to fetch a new file from the archive and the available disk space for the cache is below a certain threshold. You will need to define "check_disk" and "min_disk" in /etc/apt-cacher/apt-cacher.conf for that to work. It also introduce a new Depends on libfilesys-diskspace-perl, although it could be changed to a Recommends or Suggests.

Revision history for this message
Etienne Goyer (etienne-goyer-outlands) wrote :

I have uploaded a binary of apt-cacher 1.5.5 with my correction to my PPA:

    https://launchpad.net/~etienne-goyer-outlands/+archive

It is basically the same as the debdiff attached earlier, except with a little tweak to the package version to keep it native.

Revision history for this message
Brian Murray (brian-murray) wrote :

Looking at the attachments in this bug report, I noticed that "apt-cacher_diskspace.debdiff" was not flagged as a patch. A patch contains changes to an Ubuntu package that will resolve a bug and this attachment is one! Subsequently, I've checked the patch flag for it. In the future when submitting patches please use the patch checkbox as there are some Launchpad searches that use this feature. Thanks for your contribution Etienne Goyer!

Changed in apt-cacher:
status: Unknown → New
Changed in apt-cacher (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Changed in apt-cacher (Debian):
status: New → Fix Released
Revision history for this message
Simon Déziel (sdeziel) wrote :

Marking as Fix Released as Maverick's version include the fix.

Changed in apt-cacher (Ubuntu):
status: Triaged → Fix Released
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.