Bug 63342 - rpm database lock / signal handler / race condition
Summary: rpm database lock / signal handler / race condition
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm   
(Show other bugs)
Version: 7.2
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-04-12 18:54 UTC by Andy Grimm
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-04-12 18:54:31 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Andy Grimm 2002-04-12 18:54:26 UTC
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:

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 19:06:08 UTC
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.