Skip Menu |

This queue is for tickets about the Lucene CPAN distribution.

Report information
The Basics
Id: 49816
Status: new
Priority: 0/
Queue: Lucene

People
Owner: Nobody in particular
Requestors: tomaz.solc [...] tablix.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.18
Fixed in: (no value)



Subject: Segmentation fault in global destruction
Hi This module will sometimes crash with a segmentation fault on global destruction of variables on program termination. The bug is in the way Perl objects store references to other Perl objects they depend on. Some objects should not be destroyed by the interpreter while a particular object is still alive that depends on them. For example an IndexSearcher object should always be destroyed before a Store object that was used to create it. This is currently done by storing a RVs to Store object in the IndexSearcher object, but this only works correctly while interpreter is running. On global variable destruction the order of object destruction is still not deterministic. A similar problem in another module with the same cause is described in greater detail here: http://www.rectangular.com/pipermail/kinosearch/2008-February/003767.html I'm attaching two files: crash2.pl is a test case that causes the segmentation fault on my machine (Debian Lenny, Perl 5.10.0, i386). Since the order of destruction depends on hash ordering, the bug seemingly disappears on minor changes to the code (like adding a new global variable, etc.) lucene_global_destruction.patch is a patch that fixes this bug for me. It follows advice that is given in the post I linked above.
Subject: lucene_global_destruction.patch

Message body is not shown because it is too large.

Subject: crash2.pl
#!/usr/bin/perl -w use Lucene; my $store = Lucene::Store::FSDirectory->getDirectory("/home/avian/ft/index", 0); $searcher = Lucene::Search::IndexSearcher->new($store); my $analyzer = Lucene::Analysis::Standard::StandardAnalyzer->new;