Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-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 C8E6E7DBD for ; Tue, 4 Oct 2011 08:18:10 +0000 (UTC) Received: (qmail 10867 invoked by uid 500); 4 Oct 2011 08:18:08 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 10817 invoked by uid 500); 4 Oct 2011 08:18:08 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 10809 invoked by uid 99); 4 Oct 2011 08:18:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Oct 2011 08:18:07 +0000 X-ASF-Spam-Status: No, hits=4.0 required=5.0 tests=FREEMAIL_FROM,FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of cdoronc@gmail.com designates 209.85.215.176 as permitted sender) Received: from [209.85.215.176] (HELO mail-ey0-f176.google.com) (209.85.215.176) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Oct 2011 08:18:01 +0000 Received: by eyb7 with SMTP id 7so238576eyb.35 for ; Tue, 04 Oct 2011 01:17:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=dWnZ3qfzwu3p1wk2Zknj0uMXIktBZ0kpMcZyT68eW2s=; b=FYkNV6JucfEynkfzLQEST99WIHR7VveOohnYgYAV47b4JI7W7ovDCG5XJHc7N0EyXd 02M9zZcoCt7NvIbHWQ3858eOz3OE/4lNl74n0gUp7bhSRKA3qArNCA0q+qyXTn/ctUWh dknwTApUWNTAIT01qjyGCJNCrc5oQto8yoW5Y= MIME-Version: 1.0 Received: by 10.213.2.204 with SMTP id 12mr389948ebk.81.1317716260073; Tue, 04 Oct 2011 01:17:40 -0700 (PDT) Received: by 10.213.35.71 with HTTP; Tue, 4 Oct 2011 01:17:40 -0700 (PDT) In-Reply-To: References: <65766306-a18a-46be-8c23-db18ddb5673c@email.android.com> Date: Tue, 4 Oct 2011 10:17:40 +0200 Message-ID: Subject: Re: TaxWriter leakage? From: Doron Cohen To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=0015174beab698af6d04ae74b95f --0015174beab698af6d04ae74b95f Content-Type: text/plain; charset=ISO-8859-1 Looking into this with Shai I think we see how this can happen, in this code of LTW: private ParentArray getParentArray() throws IOException { if (parentArray==null) { // [1] if (reader == null) { reader = openReader(); } parentArray = new ParentArray(); // [2] parentArray.refresh(reader); // [3] } return parentArray; } The method getParentArray() is not synchronized, and hence if there are two calls from two different threads T1, T2, (both adding documents or such): * T1 gets to point [1] above and see null * T1 gets to point [2] and assigns a fresh parentArray * Context switch, T2 gets to "drive" * T2 gets to point [1], sees a non null parent array, and returns it immediately Since T1 did not yet get to point [3], the parent array is not yet initialized, hence the NPE that T2 gets when accessing the internal array of the parent array. If this is the case then it is surprising that this error did not yet happen. Need to open a JIRA issue for this and add some synchronization. Best if we can create this is in a standalone test. I also think that there is nothing special in the second restart, except that that by that time there were other servlets up (?) which were able to trigger simultaneous AddDoc requests, exposing this bug... Makes sense? On Tue, Oct 4, 2011 at 6:58 AM, Shai Erera wrote: > The source code is available and you can check it out from > > http://svn.apache.org/repos/asf/lucene/dev/branches/branch_3x/lucene/contrib/facet > . > After you modify the code, you can call "ant jar" (if you have Ant > installed) and it will generate the facet .jar for you. If it doesn't work > for you, let me know and I'll generate one for you. > > Shai > > On Mon, Oct 3, 2011 at 7:21 PM, Mihai Caraman >wrote: > > > Uwe : > > > > > Maybe another Java7 bug? Are you using Java 7? > > > > > Nop, java 1.6 > > > > Shai > > > return getParentArray().getArray()[ordinal]; > > > > > Can you give me a lucene jar with print outs for when it throws this NPE? > > > > ...How is using ThreadedIndexWriter related > > > > > When I remove the Threaded version, it doesn't give me any problems. > > Otherwise, when i first deploy the jar, (and maybe because it gets a bit > > overwhelmed with accumulated data(from a distributed queue-Kestrel) it > > throws that nasty error for every Indexing thread, in my case for all 6 > of. > > After that if i restart the server, no more exception. > > > > I tried to reproduce the error, with only the Readers and writers and > with > > some bogus data, but it didn't throw anything. > > > --0015174beab698af6d04ae74b95f--