Return-Path: X-Original-To: apmail-incubator-lucy-user-archive@www.apache.org Delivered-To: apmail-incubator-lucy-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 834987C05 for ; Wed, 23 Nov 2011 12:46:22 +0000 (UTC) Received: (qmail 6503 invoked by uid 500); 23 Nov 2011 12:46:22 -0000 Delivered-To: apmail-incubator-lucy-user-archive@incubator.apache.org Received: (qmail 6474 invoked by uid 500); 23 Nov 2011 12:46:22 -0000 Mailing-List: contact lucy-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucy-user@incubator.apache.org Delivered-To: mailing list lucy-user@incubator.apache.org Received: (qmail 6465 invoked by uid 99); 23 Nov 2011 12:46:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Nov 2011 12:46:22 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [68.116.39.62] (HELO rectangular.com) (68.116.39.62) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Nov 2011 12:46:14 +0000 Received: from marvin by rectangular.com with local (Exim 4.69) (envelope-from ) id 1RTC8V-0006XJ-A7 for lucy-user@incubator.apache.org; Wed, 23 Nov 2011 04:41:11 -0800 Date: Wed, 23 Nov 2011 04:41:11 -0800 From: Marvin Humphrey To: lucy-user@incubator.apache.org Message-ID: <20111123124111.GA24904@rectangular.com> References: <20111114131516.GA11643@rectangular.com> <20111117232428.GA10555@rectangular.com> <20111118141410.GA5863@rectangular.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Checked: Checked by ClamAV on apache.org Subject: Re: [lucy-user] Concurrent searching On Wed, Nov 23, 2011 at 01:25:09PM +0200, goran kent wrote: > Something is weird with the length for the top_docs packet. > > In SearchServer::serve, ~line 106, the confess is chucking a null > error because $check_val != $len, hence the meaningless error: > > " at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/LucyX/Remote/SearchServer.pm > line 106" > > In ClusterSearcher::_serialize_request for top_docs > length($serialized)==6959, but SearchServer::serve is receiving > length==2892. > > So, that's why SearchServer is failing. What's causing the short send > (or receive, or pack/unpack not co-operating across machines) will > hopefully soon be revealed. As we move away from blocking i/o, we need to manage buffers manually and be prepared for partial success. (Eventually we need to deal with timeouts and failovers, because otherwise the system remains vulnerable to its weakest link and hangs when a single node goes down -- but that's for later.) > Suggested patch: > > - confess $! unless $check_val == $len; > + confess "packet length mismatch: $!" unless $check_val == $len; Those confess() calls are placeholders, to be swapped out at some future time with a less aggressive error reporting mechanism that does not take down the server process. The idea was to use confess() during early rapid prototyping to flag each place a system call return value needs to be checked. In some cases, including here, the code also needs to be refactored around non-blocking i/o. What we ultimately need to do is accept a partial read, store the incomplete buffer, and return to waiting for the next ready socket. The code will become more complicated because we'll have to keep multiple buffers alive, but that's concurrency for ya. For now though, try this: * Change every sysread() to read(), and every syswrite() to write(). * Set $socket->autoflush(1); * Make sure 'Blocking => 0' is commented out. * Replace the select() loop with a "for" loop, because select() and blocking i/o don't mix. What I'm hoping to do with those changes is return to forcing every socket communication to block, restoring predictable program execution order. Marvin Humphrey