Bug 517286 - Yum crashes if download of a package is too quick
Yum crashes if download of a package is too quick
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: yum (Show other bugs)
5.3
x86_64 Linux
high Severity high
: rc
: ---
Assigned To: James Antill
Jan Hutař
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-13 07:41 EDT by Thomas Bellman
Modified: 2014-01-21 01:14 EST (History)
6 users (show)

See Also:
Fixed In Version: yum-3.2.22-23.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-03-30 04:29:37 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


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

  None (edit)
Description Thomas Bellman 2009-08-13 07:41:07 EDT
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 07:53:04 EDT
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 12:54:22 EDT
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-29 21:39:00 EDT
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 12:45:34 EDT
yum-3.2.24-2.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/yum-3.2.24-2.fc10
Comment 7 Fedora Update System 2009-11-04 07:06:18 EST
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 04:29:37 EDT
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.

http://rhn.redhat.com/errata/RHBA-2010-0254.html

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