You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucy.apache.org by "Marvin Humphrey (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2011/11/26 18:39:40 UTC

[lucy-issues] [jira] [Issue Comment Edited] (LUCY-192) Segmentation fault

    [ https://issues.apache.org/jira/browse/LUCY-192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13157556#comment-13157556 ] 

Marvin Humphrey edited comment on LUCY-192 at 11/26/11 5:38 PM:
----------------------------------------------------------------

There's not a lot we can do about this one.  The root problem lies in Perl's
limited type safety mechanism.

On my system, the supplied script crashes at 'use ClusterNode' because it
can't find 'ClusterNode.pm' anywhere in the search path.  Nevertheless, I
suspect what's happening here is that you've got a ClusterNode.pm lying around
somewhere which has a new() subroutine in it, and it doesn't return a proper
Lucy::Search::Searcher.

Here is a further reduction which illustrates the problem:

{noformat}
use Lucy;
my $number = 1;
my $fake = bless \$number, "Lucy::Search::Searcher";
$fake->get_schema; # segfaults
{noformat}

There's no way to stop that from segfaulting.  Our conversion mechanism can't
tell that the lucy_Searcher* pointer address which we extract from the scalar
reference doesn't actually point at a struct lucy_Searcher.

EDIT: change "$n" to "$number" in code sample so that we get the right error message.
                
      was (Author: creamyg):
    There's not a lot we can do about this one.  The root problem lies in Perl's
limited type safety mechanism.

On my system, the supplied script crashes at 'use ClusterNode' because it
can't find 'ClusterNode.pm' anywhere in the search path.  Nevertheless, I
suspect what's happening here is that you've got a ClusterNode.pm lying around
somewhere which has a new() subroutine in it, and it doesn't return a proper
Lucy::Search::Searcher.

Here is a further reduction which illustrates the problem:

{noformat}
use Lucy;
my $number = 1;
my $fake = bless \$n, "Lucy::Search::Searcher";
$fake->get_schema; # segfaults
{noformat}

There's no way to stop that from segfaulting.  Our conversion mechanism can't
tell that the lucy_Searcher* pointer address which we extract from the scalar
reference doesn't actually point at a struct lucy_Searcher.

                  
> Segmentation fault
> ------------------
>
>                 Key: LUCY-192
>                 URL: https://issues.apache.org/jira/browse/LUCY-192
>             Project: Lucy
>          Issue Type: Bug
>          Components: Perl bindings
>    Affects Versions: 0.2.2 (incubating)
>            Reporter: Dan Markham
>            Priority: Trivial
>         Attachments: log.out
>
>
> I'm able to cause a Segfault with this script. This subclass of Searcher is not playing nice but I'm sure you want to kill the segfault.
> package ClusterNode;
> BEGIN { our @ISA = qw( Lucy::Search::Searcher ) } 
> package main;
> use Lucy;
> use ClusterNode;
> my $cn = ClusterNode->new();
> my $hits = $cn->hits( query => "a" );

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira