Skip Menu |

This queue is for tickets about the Search-Xapian CPAN distribution.

Maintainer(s)' notes

Important note

Do NOT report bugs here - if you do, your report won't be read by anybody. We've asked for this tracker to simply be disabled, but apparently that's not possible at present. So if you have a package on CPAN, you get a RT tracker whether you like it or not.

Instead, report bugs in the Xapian bug tracker.





























































































































































































































































































































































































































































































































































Report information
The Basics
Id: 27575
Status: resolved
Priority: 0/
Queue: Search-Xapian

People
Owner: Nobody in particular
Requestors: andreas.marienborg [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.0.0.0
Fixed in: 1.0.1.0



Subject: Segfault when adding a valuerangeprocessor in certain conditions
I have written two testcases where one fails and one passes, depending on where I add the value range processor. This is perl, v5.8.8 built for darwin-2level Darwin Kernel Version 8.9.1 i386
Subject: vrp_broken_tests.diff
diff -urN Search-Xapian-1.0.0.0/t/lib/Wrapper.pm Search-Xapian-1.0.0.0.bug/t/lib/Wrapper.pm --- Search-Xapian-1.0.0.0/t/lib/Wrapper.pm 1970-01-01 01:00:00.000000000 +0100 +++ Search-Xapian-1.0.0.0.bug/t/lib/Wrapper.pm 2007-06-14 10:11:49.000000000 +0200 @@ -0,0 +1,28 @@ +package Wrapper; + +use strict; +use warnings; +use Moose; +use Search::Xapian qw(:standard); + +has 'index' => (isa => 'Str', is => 'rw', default => 'testdb'); +has 'language' => (isa => 'Str', is => 'rw', default => 'en'); +has 'db' => (isa => 'Search::Xapian::Database', is => 'rw') ; +has 'qp' => (isa => 'Search::Xapian::QueryParser', is => 'rw'); + +sub BUILD { + my $self = shift; + $self->db(Search::Xapian::WritableDatabase->new()); + $self->qp(Search::Xapian::QueryParser->new($self->db)); + + my $stemmer=Search::Xapian::Stem->new($self->language); + $self->qp->set_stemmer($stemmer); + $self->qp->set_stemming_strategy(STEM_SOME); + $self->qp->set_default_op(OP_AND); + + $self->qp->add_boolean_prefix("site", "H"); + $self->qp->add_boolean_prefix("id", "Q"); + +} + +1; \ No newline at end of file diff -urN Search-Xapian-1.0.0.0/t/lib/Wrapper2.pm Search-Xapian-1.0.0.0.bug/t/lib/Wrapper2.pm --- Search-Xapian-1.0.0.0/t/lib/Wrapper2.pm 1970-01-01 01:00:00.000000000 +0100 +++ Search-Xapian-1.0.0.0.bug/t/lib/Wrapper2.pm 2007-06-14 10:11:45.000000000 +0200 @@ -0,0 +1,16 @@ +package Wrapper2; + +use strict; +use warnings; +use Moose; +use Search::Xapian qw(:standard); + +extends 'Wrapper'; + +sub BUILD { + my $self = shift; + my $vrp = Search::Xapian::StringValueRangeProcessor->new(1); + $self->qp->add_valuerangeprocessor($vrp); +} + +1; \ No newline at end of file diff -urN Search-Xapian-1.0.0.0/t/x_vrp.t Search-Xapian-1.0.0.0.bug/t/x_vrp.t --- Search-Xapian-1.0.0.0/t/x_vrp.t 1970-01-01 01:00:00.000000000 +0100 +++ Search-Xapian-1.0.0.0.bug/t/x_vrp.t 2007-06-14 10:12:56.000000000 +0200 @@ -0,0 +1,22 @@ +#!/usr/bin/perl -w + +use strict; +use warnings; +use Test::More tests => 3; +use lib qw(t/lib); +use Wrapper; + +my $q = "1170288000..1181567637"; + +my $db = Wrapper->new(); + +my $qp = $db->qp; + +my $vrp = Search::Xapian::StringValueRangeProcessor->new(1); +$qp->add_valuerangeprocessor($vrp); + +isa_ok($qp, "Search::Xapian::QueryParser"); +my $query = $qp->parse_query($q); +ok(1, "parse_query worked"); + +is($query->get_description, "Xapian::Query(VALUE_RANGE 1 1170288000 1181567637)"); diff -urN Search-Xapian-1.0.0.0/t/x_vrp_2.t Search-Xapian-1.0.0.0.bug/t/x_vrp_2.t --- Search-Xapian-1.0.0.0/t/x_vrp_2.t 1970-01-01 01:00:00.000000000 +0100 +++ Search-Xapian-1.0.0.0.bug/t/x_vrp_2.t 2007-06-14 10:13:06.000000000 +0200 @@ -0,0 +1,19 @@ +#!/usr/bin/perl -w + +use strict; +use warnings; +use Test::More tests => 3; +use lib qw(t/lib); +use Wrapper2; + +my $q = "1170288000..1181567637"; + +my $db = Wrapper2->new(); + +my $qp = $db->qp; + +isa_ok($qp, "Search::Xapian::QueryParser"); +my $query = $qp->parse_query($q); +ok(1, "parse_query worked"); + +is($query->get_description, "Xapian::Query(VALUE_RANGE 1 1170288000 1181567637)");
Subject: Re: [rt.cpan.org #27575] Segfault when adding a valuerangeprocessor in certain conditions
Date: Fri, 15 Jun 2007 23:37:05 +0100
To: via RT <bug-Search-Xapian [...] rt.cpan.org>
From: Olly Betts <olly [...] survex.com>
On Thu, Jun 14, 2007 at 04:26:27AM -0400, via RT wrote: Show quoted text
> > Thu Jun 14 04:26:25 2007: Request 27575 was acted upon. > Transaction: Ticket created by ANDREMAR > Queue: Search-Xapian > Subject: Segfault when adding a valuerangeprocessor in certain conditions > Broken in: 1.0.0.0 > Severity: (no value) > Owner: Nobody > Requestors: ANDREMAR@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=27575 > > > > I have written two testcases where one fails and one passes, depending > on where I add the value range processor.
The test cases need a "Moose" module, so I can't run them, but I believe the issue is that the Perl wrapper object reference count doesn't get incremented when it is passed to a method like add_valuerangeprocessor() so Perl garbage collects it when the "my" declaration goes out of scope and the Perl wrapper object then deletes the underlying C++ object. I believe Stopper objects have the same issues, but most Xapian classes are also reference counted internally so don't. This needs addressing, but a workaround is to ensure the set object remains in scope. Cheers, Olly
This now works in 1.0.1.0.