You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucy.apache.org by Marvin Humphrey <ma...@rectangular.com> on 2011/10/31 13:13:24 UTC

Re: [lucy-user] Remote SearchServer and PolySearcher(SearchClient) usage

On Mon, Oct 31, 2011 at 12:59:37PM +0200, goran kent wrote:
> my @searcher;
> # batch of remote nodes to search
> foreach my $remote_host (qw(10.0.0.1)) {
>     push @searcher, LucyX::Remote::SearchClient->new(
>         peer_address => qq($remote_host:7890),
>         password     => $pw,
>     );
> }

Please try adding a Schema to SearchClient's constructor arguments.

     push @searcher, LucyX::Remote::SearchClient->new(
         peer_address => qq($remote_host:7890),
         password     => $pw,
+        schema       => $schema,
     );


I can duplicate your symptoms by commenting out the schema argument in
t/510-remote.t.

It seems that the autogenerated XS binding for Lucy::Search::Searcher#new
(invoked as SUPER::new from within SearchClient.pm) is not throwing an error
when it should to indicate that the required 'schema' param is missing.

Marvin Humphrey


Re: [lucy-user] Remote SearchServer and PolySearcher(SearchClient) usage

Posted by goran kent <go...@gmail.com>.
On 10/31/11, Marvin Humphrey <ma...@rectangular.com> wrote:
 So apparently we have an IO::Select object that thinks it's ready to read,
> but
> when we read from it, we don't get anything.
>
> I'm not sure how to duplicate this locally.
>
> Just asking, but have you tried restarting the server?

By server, I assume you mean the SearchServer script.  Yes, I have to
restart it (since it dies after every search served) before every
search from the remote client machine.

strace(1) on the SearchServer shows this code being invoked as a
possible consequence of 0 bytes being read from the client socket:

# Sanity check the method name.
elsif ( !$dispatch{$method} ) {
    print $client_sock "ERROR: Bad method name: $method\n";
    next;
}

where $method is empty:

...writing results to the client socket (124)...
write(124, "to open a shop, a painting shop "..., 2615) = 2615

...select says client is saying something...
select(128, [123 124], NULL, NULL, NULL) = 1 (in [124])

...read from client...
read(124, "", 4096)                     = 0

...unexpected 0 bytes from client, and error...
write(2, "Use of uninitialized value in ch"..., 153) = 153
write(2, "Use of uninitialized value in st"..., 157) = 157
write(2, "Use of uninitialized value in st"..., 157) = 157
write(2, "Use of uninitialized value in ha"..., 160) = 160
write(2, "Use of uninitialized value in co"..., 175) = 175
write(124, "ERROR: Bad method name: \n", 25) = 25

I tried adding a bit of debugging to LucyX/Remote/SearchClient.pm (sub
_rpc) on the client machine:

    my $packed_len = pack( 'N', bytes::length($serialized) );
+    print "DEBUG: sending [$method] len:" .
length("$packed_len$serialized") . "\n";
    print $sock "$method\n$packed_len$serialized";

But everything being sent has a positive length; ie, nothing to
account for that "Bad method name" error above.  Perhaps it's being
sent elsewhere, or I'm misreading what's happening.

/me yawns, almost time for bed

Re: [lucy-user] Remote SearchServer and PolySearcher(SearchClient) usage

Posted by Marvin Humphrey <ma...@rectangular.com>.
On Mon, Oct 31, 2011 at 05:48:44PM +0200, goran kent wrote:
> This worked to the extent that search results are now displayed by the
> SearchClient, but the SearchServer still dies with the same errors...
> what else can I do to help you narrow it down?

SearchServer is written in pure Perl.  There is something amiss with the socket
read, but I'm not sure what.  Here is the first warning message you saw:

    Use of uninitialized value $method in chomp at /Users/marvin/projects/lucysvn/perl/blib/lib/LucyX/Remote/SearchServer.pm line 105, <GEN2> line 5.

This is the relevant section, with the last line's chomp triggering the
warning:

    my $read_set  = IO::Select->new($main_sock);

    while ( my @ready = $read_set->can_read ) {
        for my $readhandle (@ready) {
            # If this is the main handle, we have a new client, so accept.
            if ( $readhandle == $main_sock ) {

            ...

            # Otherwise it's a client sock, so process the request.
            else {
                my $client_sock = $readhandle;
                my ( $check_val, $buf, $len, $method, $args );
                chomp( $method = <$client_sock> );

So apparently we have an IO::Select object that thinks it's ready to read, but
when we read from it, we don't get anything.

I'm not sure how to duplicate this locally.

Just asking, but have you tried restarting the server?

Marvin Humphrey


Re: [lucy-user] Remote SearchServer and PolySearcher(SearchClient) usage

Posted by goran kent <go...@gmail.com>.
On 10/31/11, Marvin Humphrey <ma...@rectangular.com> wrote:
> Please try adding a Schema to SearchClient's constructor arguments.
>
>      push @searcher, LucyX::Remote::SearchClient->new(
>          peer_address => qq($remote_host:7890),
>          password     => $pw,
> +        schema       => $schema,
>      );

Thanks for the quick response.

This worked to the extent that search results are now displayed by the
SearchClient, but the SearchServer still dies with the same errors...
what else can I do to help you narrow it down?

Thanks