Ticket #820 (closed defect: fixed)

Opened 5 years ago

Last modified 4 years ago

Rpmdb should keep better track of its children


Reported by: pmatilai Assigned to: RpmTickets Priority: major Milestone:
Component: rpm Version: RPM Development Keywords: Cc:


Description

It's way too easy to create dangling iterators. Trivial reproducer in python

>>> import rpm
>>> ts = rpm.ts()
>>> mi = ts.dbMatch('name')
>>> ts.closeDB() # or del ts for that matter

...and poof, mi's locks can't be released without exiting the process (or calling rpmdbCheckTerminate() on C-side which ends up doing the same).

Rpm should close + invalidate the iterators before closing the db itself to avoid creating these zombies.

Change History

04/15/11 07:18:31 changed by pmatilai

  • status changed from new to closed.
  • resolution set to fixed.

This was simpler than I thought: iterators take a refcount on the database so all that is needed is to use rpmdbClose() on iterator free instead of only decrementing refcount.