Bug 253955

Summary: 3.2.3 seems to destroy rpm db after transaction failure
Product: [Fedora] Fedora Reporter: Mamoru TASAKA <mtasaka>
Component: yumAssignee: Jeremy Katz <katzj>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: herrold, james.antill, pmatilai
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-08-23 12:34:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mamoru TASAKA 2007-08-23 06:45:00 UTC
Version-Release number of selected component (if applicable):
yum-3.2.3-1.fc8

Description of problem:
Well, as I always activate koji repo on yum, I hit yum updates
so I installed yum 3.2.3-1.fc8 a few hours ago beforehand.

And also I hit many updates (from koji). So I tried to update
them. Then...
-----------------------------------------------------
Excluding Packages in global exclude list
Finished
Setting up Upgrade Process
Resolving Dependencies
--> Running transaction check
<very long line omitted>

 recode                  i386       3.6-24.fc8       koji              851 k
 redland                 i386       1.0.5-6.fc8      koji              202 k
 samba-common            i386       3.0.25c-3.fc8    koji              7.2 M
 system-config-firewall-tui  noarch     1.0.4-1.fc8      koji              366 k

Transaction Summary
=============================================================================
Install      4 Package(s)         
Update     177 Package(s)         
Remove       0 Package(s)         

Total download size: 202 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
install-info: warning: no entries found for `/usr/share/info/grub.info.gz';
nothing deleted
install-info: warning: no entries found for `/usr/share/info/multiboot.info.gz';
nothing deleted
Traceback (most recent call last):
  File "/usr//bin/yum", line 29, in <module>
    yummain.main(sys.argv[1:])
  File "/usr/share/yum-cli/yummain.py", line 180, in main
    base.doTransaction()
  File "/usr/share/yum-cli/cli.py", line 382, in doTransaction
    self.runTransaction(cb=cb)
  File "/usr/lib/python2.5/site-packages/yum/__init__.py", line 571, in
runTransaction
    errors = self.ts.run(cb.callback, '')
  File "/usr/lib/python2.5/site-packages/yum/rpmtrans.py", line 251, in callback
    self._instProgress( bytes, total, h )
  File "/usr/lib/python2.5/site-packages/yum/rpmtrans.py", line 330, in
_instProgress
    self.complete_actions, self.total_actions)
  File "/usr/share/yum-cli/output.py", line 485, in event
    if self.output and (sys.stdout.isatty() or bytes == total):
NameError: global name 'bytes' is not defined
-----------------------------------------------------------

Then yum exited with abmormal state.
After that:
------------------------------------------------------------
[root@localhost ~]# rpm -q pango
package pango is not installed
[root@localhost ~]# rpm -q redland
package redland is not installed
[root@localhost ~]# rpm -q recode
package recode is not installed
-------------------------------------------------------------
I cannot figure out what happened....

NOTE: I always save the downloaded rpms even after yum transaction is
      finished and this time I recovered by myself the state that many
      rpms seemed to be deleted.

How reproducible:
Only tried once..

Comment 1 Mamoru TASAKA 2007-08-23 07:01:50 UTC
Note:
After this failure, only pam-0.99.8.1-5.fc8 remained in rpm entry and 
the other 180 rpms seemed to have been removed from rpm entry.

Comment 2 Mamoru TASAKA 2007-08-23 07:35:42 UTC
Well, reproduced again on the following set:

=============================================================================
 Package                 Arch       Version          Repository        Size 
=============================================================================
Updating:
 WindowMaker             i386       0.92.0-14.fc8    koji              1.9 M
 mc                      i386       1:4.6.1a-49.20070604cvs.fc8  koji          
   2.1 M
 w3c-libwww-devel        i386       5.4.1-0.5.20060206cvs.fc8  koji            
 205 k
Updating for dependencies:
 WINGs-libs              i386       0.92.0-14.fc8    koji              309 k
 w3c-libwww              i386       5.4.1-0.5.20060206cvs.fc8  koji            
 380 k

Transaction Summary
=============================================================================

More precisely I did yum update on CUI like:

# ( LANG=C ; yum -y upgrade --exclude=foo --exclude=baa 2>&1 | tee yum-update.log )

Comment 3 Panu Matilainen 2007-08-23 08:13:56 UTC
Eek... yum dies in callback function in middle of transaction, that's very
deadly indeed.

Comment 4 Seth Vidal 2007-08-23 12:34:03 UTC
now I am confused. Exiting in the middle of a transaction will DESTROY the
rpmdb? What the hell?

I've fixed the bug - I have no idea how it wasn't triggered before this - I must
have run 100 transactions with this code but I never ran any of them dumping
output to a file or tee - I'll add that to the tests to run.




Comment 5 Panu Matilainen 2007-08-23 13:31:34 UTC
Mamoru, if you can easily reproduce / have the demolished rpmdb still available,
I'd appreciate if you can tar up the contents of /var/lib/rpm and put somewhere
on the net where I can grab it for inspection (do NOT attach here, it's way too
big).
I'd like to see if what you're seeing is corruption of sorts, or have the
entries *really* just gone up the wind.

Comment 6 Mamoru TASAKA 2007-08-23 14:41:49 UTC
(In reply to comment #5)
> Mamoru, if you can easily reproduce / have the demolished rpmdb still available,
> I'd appreciate if you can tar up the contents of /var/lib/rpm and put somewhere
> on the net where I can grab it for inspection (do NOT attach here, it's way too
> big).
> I'd like to see if what you're seeing is corruption of sorts, or have the
> entries *really* just gone up the wind.

Well, actually it seems reproducible when I use yum-3.2.3-1.fc8
with recording transaction log by using tee (as said in
comment 2) 

I put the "destroyed" rpmdb on
http://mtasaka.fedorapeople.org/RPM-contain-corrputed.tar.gz
(note: 31.8 Mbyte)

Here yum tries to update
udev units wxsvg-devel xcdroast xmlto yasm zisofs-tools wxsvg
(log included in tarball)
and after yum transaction failure, rpmdb returns that
udev units wxsvg-devel xcdroast xmlto zisofs-tools are not installed.

(I have not checked 3.2.3-2.fc8 yet)


Comment 7 Panu Matilainen 2007-08-23 14:53:04 UTC
Thanks, I've downloaded that now so feel free to remove from eating up your
quota. I'll have a closer look tomorrow hopefully.

Comment 8 Mamoru TASAKA 2007-08-23 18:06:28 UTC
Well, actually with 3.2.3-2.fc8 transaction failure seems disappeared.
Thanks.

Comment 9 Panu Matilainen 2007-08-23 18:36:06 UTC
Yes, not crashing in middle of transaction helps :) What I'm curious about is
the effect on the rpmdb: typically when transaction crashes you get duplicates,
not removed entries.