Opened 5 years ago
Last modified 4 years ago
Reported by: pmatilai Assigned to: RpmTickets
Priority: major Milestone:
Component: rpm Version: RPM Development
Keywords: Cc:
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.
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.