]> Sergey Matveev's repositories - public-inbox.git/commitdiff
workaround Xapian OFD locks w/o close-on-exec
authorEric Wong <e@80x24.org>
Thu, 24 May 2018 08:32:16 +0000 (08:32 +0000)
committerEric Wong <e@80x24.org>
Thu, 24 May 2018 08:32:42 +0000 (08:32 +0000)
Xapian v1.2.21..v1.2.24 (inclusive) use OFD locks but failed to
set the close-on-exec flag on those locks.  So we must continue
to work around those old versions by ensuring Xapian file
descriptors aren't held any longer than necessary when in
long-running git processes.

Reported-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
lib/PublicInbox/SearchIdx.pm
t/convert-compact.t
t/v2mirror.t

index 74f9267ec0a8460e3a2eac40b2cb51967de78abd..107cd3457133cbe9d9442045dd0e5b7a2cc06d04 100644 (file)
@@ -666,6 +666,7 @@ sub _index_sync {
 
                $self->{over}->rollback_lazy;
                $self->{over}->disconnect;
+               $git->cleanup;
                delete $self->{txn};
                $xdb->cancel_transaction;
                $xdb = _xdb_release($self);
@@ -696,6 +697,7 @@ sub _index_sync {
                        }
                }
                $self->commit_txn_lazy;
+               $git->cleanup;
                $xdb = _xdb_release($self);
                # let another process do some work... <
                if (!$newest) {
index e92320037003a6d9c3c7dde014e938c4634164e1..def03436231680c7b79e6fcc35939a7aca8a7fda 100644 (file)
@@ -40,7 +40,10 @@ ok($im->add($mime), 'added one message');
 ok($im->remove($mime), 'remove message');
 ok($im->add($mime), 'added message again');
 $im->done;
-PublicInbox::SearchIdx->new($ibx, 1)->index_sync;
+for (1..2) {
+       eval { PublicInbox::SearchIdx->new($ibx, 1)->index_sync; };
+       is($@, '', 'no errors syncing');
+}
 
 is(((stat("$ibx->{mainrepo}/public-inbox"))[2]) & 07777, 0755,
        'sharedRepository respected for v1');
index 9e0c9e1d17c0b58df9f6db69bd05b92736f928d4..4cd369bd204d3c7ce9497a6a162b9d97ba880727 100644 (file)
@@ -50,7 +50,7 @@ for my $i (1..9) {
        $mime->header_set('Subject', "subject = $i");
        ok($v2w->add($mime), "add msg $i OK");
 }
-$v2w->barrier;
+$v2w->done;
 
 my %opts = (
        LocalAddr => '127.0.0.1',