[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: RPM lockup (probably user error)...
- From: Jeff Johnson <jbj redhat com>
- To: rpm-list redhat com
- Subject: Re: RPM lockup (probably user error)...
- Date: Fri, 4 Apr 2003 14:26:45 -0500
On Fri, Apr 04, 2003 at 12:24:03PM -0500, James Olin Oden wrote:
> Hi All,
>
> I recently was working with RPM2 (the cpan module exposing
> rpm's functionality written by Chip Turner), and I found a way
> that could cause a complete deadlock with the RPM database.
> Note before I show you the code, I realize what I was doing was
> inherently wrong, but I am not sure I should have got quite
> the results I received:
>
> foreach $rpm_vr (keys(%rpms)) {
> #
> # Get some values from the data structure.
> $rpm_name = $rpms{$rpm_vr}->{'name'};
>
> $iterator = $rpmdb->find_by_name_iter($rpm_name);
> while ($pkg = $iterator->next) {
> print "Erasing old test rpm " . $pkg->as_nvre() . "\n";
> $rc = system('rpm', '-e', $pkg->as_nvre());
> if($rc) {
> print "Could not clean up previous test rpms!\n";
> exit(1);
> }
> }
> }
>
> The thrust of what I am doing is:
>
> 1) Open the rpm database via RPM2.
> 2) Request an iterator for an rpm of a particular name.
> 3) Walk through the instances and try to use the rpm CLI
> to delete each instance.
>
There are constraints on database access through API, basically you don't want
two cursors open simultaneously.
Walk an iterator, saving all instances, close iterator.
For each instance, add erase element to transaction.
> OK, that last part is bad idea for multiple reasons, but what happens
> is quite odd in that not only does the program halt (we have deadlock
> I suppose as RPM2 is accessing the database, and the rpm CLI is also
> trying to access the same record) but I cannot kill the program with
> CTRL-C or CTRL-|. Is it intentional that one should not be able
> to kill the rpm cli in such a scenario?
Yup, signal handlers enabled while iterating, deadlock and you *will*
need kill -9.
Ain't databases fun?
73 de Jeff
--
Jeff Johnson ARS N3NPQ
jbj@redhat.com (jbj@jbj.org)
Chapel Hill, NC
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[]