Bug 63342 - rpm database lock / signal handler / race condition
rpm database lock / signal handler / race condition
Status: CLOSED DEFERRED
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
7.2
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Jeff Johnson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-04-12 14:54 EDT by Andy Grimm
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-04-12 14:54:31 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Andy Grimm 2002-04-12 14:54:26 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; SunOS 5.8 sun4u)

Description of problem:
I was running this loop to get a list of packages in a nice format:

j=1; for i in `rpm -qa | sort`; do rpm -q --queryformat "$j   "%{NAME}"\n" $i;
j=$(($j+1)); done

I hit Ctrl-c before it finished, then each time I tried to run rpm as root, it
hung.  I eventually figured out that it was because I was waiting for a lock on
the database.
I removed __db.001 and __db.002 from /var/lib/rpm and that fixed the problem.  

Version-Release number of selected component (if applicable):


How reproducible:
Sometimes

Steps to Reproduce:
1.  As root, run a for loop with a series of rpm queries:
j=1; for i in `rpm -qa | sort`; do rpm -q --queryformat "$j   "%{NAME}"\n" $i;
j=$(($j+1)); done
2.  Hit Ctrl-c before the loop finishes
3.  Check /var/lib/rpm/ for the files __db.00*
4.  If they do not exist, repeat steps 1-3

Actual Results:  rpm will hang the next time it is run as root unless the
__db.00* files are deleted

Expected Results:  rpm should properly handle the signal and clean up the locks.

Additional info:

This still occurs with the latest rpm release for 7.x (4.0.4)
Comment 1 Jeff Johnson 2002-04-12 15:06:08 EDT
rpm removes the __db files before opening the
database. This does not fix the problem of
removal when root does ^C and user has not
write permission in /var/lib/rpm. That is
gonna take either
	a) shared posix mutexes
	b) a setgid helper
	c) signal handling in rpmlib
ATM, I'm waiting to see if NGPT is gonna
have shared posix mutexes before undertaking
a setgid helper.

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