Bug 517286 - Yum crashes if download of a package is too quick
Summary: Yum crashes if download of a package is too quick
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: yum
Version: 5.3
Hardware: x86_64
OS: Linux
Target Milestone: rc
: ---
Assignee: James Antill
QA Contact: Jan Hutař
Depends On:
TreeView+ depends on / blocked
Reported: 2009-08-13 11:41 UTC by Thomas Bellman
Modified: 2018-10-27 15:13 UTC (History)
6 users (show)

Fixed In Version: yum-3.2.22-23.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2010-03-30 08:29:37 UTC
Target Upstream Version:

Attachments (Terms of Use)
Ugly patch fixing the crash (1.02 KB, patch)
2009-08-13 11:53 UTC, Thomas Bellman
no flags Details | Diff

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2010:0254 0 normal SHIPPED_LIVE yum bug fix update 2010-03-29 12:46:52 UTC

Description Thomas Bellman 2009-08-13 11:41:07 UTC
When running 'yum update', Yum can crash with a ZeroDivisionError:

    Downloading Packages:
    Traceback (most recent call last):
      File "/usr/bin/yum", line 29, in ?
	yummain.user_main(sys.argv[1:], exit_code=True)
      File "/usr/share/yum-cli/yummain.py", line 229, in user_main
	errcode = main(args)
      File "/usr/share/yum-cli/yummain.py", line 181, in main
	return_code = base.doTransaction()
      File "/usr/share/yum-cli/cli.py", line 386, in doTransaction
	problems = self.downloadPkgs(downloadpkgs, callback_total=self.download_callback_total_cb) 
      File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 1162, in downloadPkgs
	callback_total(remote_pkgs, remote_size, beg_download)
      File "/usr/share/yum-cli/output.py", line 949, in download_callback_total_cb
	ui_bs   = tl.add(' %5sB/s' % self.format_number(remote_size / dl_time))
    ZeroDivisionError: float division

This happens when the download of the package is too fast.  We
have a repository on NFS, which can make the download of small
RPMs quick enough that the two calls to time.time() return the
same value.  I presume this can happen for other Yum operations
downloading packages as well, but I haven't verified that.

Reproducability is low.  It only happens occasionally for us, and
I think I have only seen this on Xen guests; the time reported by
time.time() seems to increment more seldom (but in larger steps)
on some, but not all, of those.

Yum version is yum-3.2.19-18.el5.centos

The system where I see this is actually running CentOS 5.3, but
I have looked at a real RHEL 5 system as well, and in Fedora 11
(yum-3.2.23-3.fc11), and the relevant code in yum-cli/output.py
looks identical.

Comment 1 Thomas Bellman 2009-08-13 11:53:04 UTC
Created attachment 357306 [details]
Ugly patch fixing the crash

I believe the attached patch solves the problem, although I haven't
actually managed to test it, since the problem is very intermittent.

My choice of speed to report when yum were to divide by zero is 
debatable.  I first tried using +Inf, but that will just cause
format_number() to hang in an infinite loop...  A perhaps better
choice would be to set dl_speed to None, and update format_number()
to show that as "N/A" or something like that.

Comment 2 Rob James 2009-08-13 16:54:22 UTC
We are seeing this issue too on RHEL 5.3 on Xen guests. Even if it doesn't crash, the speed calculation ends up just being wrong because of the low resolution of the clock.

Comment 5 Fedora Update System 2009-09-30 01:39:00 UTC
yum-3.2.24-2.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 6 Fedora Update System 2009-10-19 16:45:34 UTC
yum-3.2.24-2.fc10 has been submitted as an update for Fedora 10.

Comment 7 Fedora Update System 2009-11-04 12:06:18 UTC
yum-3.2.24-2.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 errata-xmlrpc 2010-03-30 08:29:37 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.