[Xapian-discuss] Perl threads and Xapian - incompatibility?

Ron Kass ron at pidgintech.com
Fri Oct 19 01:15:52 BST 2007


Try the following code:

    #!/usr/bin/perl -W

    use strict;
    use threads;
    use Search::Xapian;
    my $Xapian_DB =
    Search::Xapian::WritableDatabase->new("test",Search::Xapian::DB_CREATE_OR_OPEN);

    my $Thr1 = threads->create(sub{print "1\n"});
    my $Thr2 = threads->create(sub{print "2\n"});
    my $Thr3 = threads->create(sub{print "3\n"});
    print "joins #1\n";
    $Thr1->join;
    print "joins #2\n";
    $Thr2->join;
    print "joins #3\n";
    $Thr3->join;  

here is what we get: # perl tst.pl

    joins #1
    1
    2
    3
    joins #2
    Segmentation fault  

Setting: Xapian 1.0.3 (flint backend), perl 5.8.8, threads 1.67

Notice that ALL it takes is an open Xapian DB. It doesn't have to be a 
writable one btw.
You can replace the line with a [my $Xapian_DB = 
Search::Xapian::Database->new("test");] if you already have a test 
database in place. Same error.
Notice that the bug happens on the SECOND call to a thread instance. It 
can be a call to the detach method [->detach();].. same error.
 
Anyone saw this bug? Any patches for that one?

Best regards,
Ron


More information about the Xapian-discuss mailing list