When running 'yum update', Yum can crash with a ZeroDivisionError:
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
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
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.
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.
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.
yum-3.2.24-2.fc10 has been submitted as an update for Fedora 10.
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.
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.