Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 83236

Summary: rpm leaves behind __db.00* lockfiles after any rpm query
Product: [Retired] Red Hat Linux Reporter: M Glass <multisupport>
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED WORKSFORME QA Contact: Mike McLean <mikem>
Severity: high Docs Contact:
Priority: high    
Version: 8.0CC: noudlnx
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: 2003-01-31 18:27:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description M Glass 2003-01-31 18:19:25 UTC
Description of problem:
After having many troubles with rpm hangs, I performed the rpm 
database "recovery" (http://www.rpm.org/hintskinks/repairdb/), which gave no 
complaints.

(I have been trying to install an Openview Operations agent (has rpms), which 
was sporadically failing.  It uses an install script which basically does 
about six "rpm -i" commands to install its rpms.)

Somehow the database is in some state where any rpm command (that actually 
reads) will cause it to leave behind the /var/lib/rpm/__db.00* lock files.  
After this, database reads will work, but write operations will hang.  Even 
operations such as "--rebuilddb" will leave behind the lock files.  Queries 
for non-existant packages will also leave behind the files.


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

How reproducible:

Steps to Reproduce:
1. Get a bad package installation that causes hangs (can be provided)
2. rpm -q anything
3. Note existence of lock files.
4. Delete lock files before you try anything that writes to database...
    
Actual results:
# ls /var/lib/rpm/__db.00* -l
-rw-r--r--+   1 root     root         8192 Jan 31 10:21 __db.001
-rw-r--r--+   1 root     root      1310720 Jan 31 10:21 __db.002
-rw-r--r--+   1 root     root       360448 Jan 31 10:21 __db.003

Expected results:
No lock files present.

Additional info:
Running base Red Hat 8.0 upgraded from 7.1. rpm version: rpm-4.1-1.06

Comment 1 Jeff Johnson 2003-01-31 18:27:56 UTC
Note carefully:
    The __db files are not "lock files" but files that contain locks.

The existence of __db files is not your problem, the existence
of stale locks is.

There are 2 main causes of stale locks.
1) missed SIGCHLD causes rpm-4.1 to "hang"
    If using rpm-4.1-1.06, upgrade to rpm-4.1-9 packages
    from ftp://people.redhat.com/jbj/test-4.1, the missed
    SIGCHLD is fixed there.

2) abnormal termination (e.g. "kill -9") leaves stale locks
    It's up to the user to do "rm -f /var/lib/rpm/__db*" in this
    case.

A more complete description is in bugzilla, look for the summary
    rpm-4.1 hangs: READ THIS FIRST