Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BDBC7200B22 for ; Wed, 1 Jun 2016 11:40:26 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BAA28160A46; Wed, 1 Jun 2016 09:40:26 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B7BCC160A41 for ; Wed, 1 Jun 2016 11:40:25 +0200 (CEST) Received: (qmail 67779 invoked by uid 500); 1 Jun 2016 09:40:24 -0000 Mailing-List: contact blur-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: blur-user@incubator.apache.org Delivered-To: mailing list blur-user@incubator.apache.org Received: (qmail 67767 invoked by uid 99); 1 Jun 2016 09:40:24 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Jun 2016 09:40:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 14306C25F1 for ; Wed, 1 Jun 2016 09:40:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.179 X-Spam-Level: ** X-Spam-Status: No, score=2.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_REPLY=1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id CNnu9k4oloiJ for ; Wed, 1 Jun 2016 09:40:22 +0000 (UTC) Received: from mail-oi0-f46.google.com (mail-oi0-f46.google.com [209.85.218.46]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 990A35FCF7 for ; Wed, 1 Jun 2016 09:40:21 +0000 (UTC) Received: by mail-oi0-f46.google.com with SMTP id w184so18786949oiw.2 for ; Wed, 01 Jun 2016 02:40:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=EP7SAKII6rvh6PxgiJu5fDi/vpZ0rGVI5rUF2Fq7g0c=; b=MeAy1NksB+NzhBfsqf1LnsjR2EumVp0AB5n6cSOG+4QQ4anICfu3acYu0D8AxM328I pR1KYq4/LUNefnbljDZYzd1AK8eDqpT4Ck1V8qdtnH8ZxUn9X+bG7XorpH+/FsL6D7ML 5Pv+kKn0iippti+tkcBCRm0DUiMUW/+cb64fOjj7clA8BzaFnsbv7cPzJ1Yc4FFkRLUh ggy5/npFVgVPTYDRluApPE+n+PFYKsHQrfDLRf6XG1cAAkOz9dtlL/ZcZ9gnefmsSHd5 N08NtGHu8quOZigQrgwWAnxXRBZAT1y7RzowY5MICaYBK3cQyvUMUhPX/pmy+4EEDIOv flqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=EP7SAKII6rvh6PxgiJu5fDi/vpZ0rGVI5rUF2Fq7g0c=; b=A7MIWOmFSHnMI6DEgPKpNupjf0b/0jdOySS1nPCMyAa6MZTlbEARZIn+z1qX1pr0qg S3JuLopeH2V96kU9sQgfUJCqABZYkprCSxJ6XmpDiaTdVCKZ/18++NL0EVRUAzld/h7q 55I2X43kWu4seEDX05HUV3gfIWZXL3PgTBNCwfkzO5hGVQaW5uA7EAM+oIZe6INUfL4S KydSsZPNSufXMVhYBvh2YmYFnyJ8HOCyQuNxMZyPXm1uo5oE0Xh7dQhjhDC+yS8LPaeH 4tY+2uOVvxzN70Tjj8Hce2Z+W6ywxLc4m0zPWVw4eL+gU6rCqKlC0ufBW062vYSf81Es E5Fw== X-Gm-Message-State: ALyK8tJ+rIJIFCHT0YWxZKzzXg3PNHbww+pUaTKRhapGiC2V5/+NGYzns5jMGPl6vgDKQhOQWswp73QK4Um7ZQ== MIME-Version: 1.0 X-Received: by 10.202.213.88 with SMTP id m85mr19686014oig.24.1464774020351; Wed, 01 Jun 2016 02:40:20 -0700 (PDT) Received: by 10.157.13.167 with HTTP; Wed, 1 Jun 2016 02:40:20 -0700 (PDT) In-Reply-To: References: Date: Wed, 1 Jun 2016 15:10:20 +0530 Message-ID: Subject: Re: IndexReaderClosedException... From: Ravikumar Govindarajan To: "blur-user@incubator.apache.org" Content-Type: multipart/alternative; boundary=001a113b029428d54705343447b2 archived-at: Wed, 01 Jun 2016 09:40:26 -0000 --001a113b029428d54705343447b2 Content-Type: text/plain; charset=UTF-8 > > In newer versions of the code there are multiple streams involved. One for > each open file handle plus if a sequential read is detected a new stream is > created for the instance for better performance Great. We just patched up our Blur version with this code. While I was digging at the reader-closed issue, was quite surprised to observe the following behavior - Issue a commit - Lucene opens a new reader via IndexWriter. (Doesn't re-use our already opened DirectoryReader) - Processes all updates/deletes/merges - Closes the new reader - Complete commit For a big index & lots of commits, opening a new-reader for every commit is prohibitively expensive. Here is the JIRA for it... https://issues.apache.org/jira/browse/LUCENE-2297 All we need to do is just set "readerPooling=true" in IndexWriterConfig class Please do explore this option when you find time. -- Ravi On Tue, May 24, 2016 at 7:48 PM, Aaron McCurry wrote: > On Tue, May 24, 2016 at 6:06 AM, Ravikumar Govindarajan < > ravikumar.govindarajan@gmail.com> wrote: > > > We have solved it temporarily by using a KeepLastTwoCommits del policy. > We > > don't get these exceptions now!!! > > > > Great! > > > > > > Btw, I see that pread calls in FSDataInputStream.java are synchronized. > Is > > it possible that merge DFS read calls could potentially block search DFS > > read calls? > > > > Yes. > > > > > > Would it be a good idea to have 2 DFSInputStreams for every file, one for > > merge & another for search? > > > > In newer versions of the code there are multiple streams involved. One for > each open file handle plus if a sequential read is detected a new stream is > created for the instance for better performance. Checkout the > HdfsDirectory class. > > Aaron > > > > > > On Tue, May 10, 2016 at 7:43 PM, Ravikumar Govindarajan < > > ravikumar.govindarajan@gmail.com> wrote: > > > > > Sorry, I mis-understood the code. > > > I see that it has 2 locks IndexRefreshWriteLock & > IndexRefreshReadLock. > > > They look to be separate > > > > > > On Tue, May 10, 2016 at 7:16 PM, Ravikumar Govindarajan < > > > ravikumar.govindarajan@gmail.com> wrote: > > > > > >> Thanks a lot Aaron. > > >> > > >> I guess we took a commit of 0.2.2 that doesn't have the > > >> IndexRefreshWriteLock (IRWL). It looks like it co-ordinates between > > >> searches & incoming mutation commits. If so, then it will likely solve > > the > > >> first issue for us (AlreadyClosedException) > > >> > > >> > > >> Can you recollect if that was the reason IRWL was introduced? > > >> > > >> On Tue, May 10, 2016 at 6:40 PM, Aaron McCurry > > >> wrote: > > >> > > >>> On Tue, May 10, 2016 at 2:30 AM, Ravikumar Govindarajan < > > >>> ravikumar.govindarajan@gmail.com> wrote: > > >>> > > >>> > Actually there are 2 issues... > > >>> > > > >>> > 1. IndexReaderClosedException > > >>> > 2. HDFS Stream Closed > > >>> > > > >>> > > >>> Likely when the index is closed it closes the underlying indexinputs > as > > >>> well causing the HDFS Stream closed exception. > > >>> > > >>> > > >>> > > > >>> > Merge completion results in File Deletion & ultimately HDFS Stream > > >>> Closed > > >>> > during Search.... > > >>> > > > >>> > I use IndexFileDeleter with KeepOnlyLastCommitDeletionPolicy. This > > >>> blindly > > >>> > deletes the file, without bothering to cross-check > > >>> IndexReader.RefCount > > > >>> > 0. > > >>> > > > >>> > > >>> Hmm. You can see here: > > >>> > > >>> > > >>> > > > https://github.com/apache/incubator-blur/blob/release-0.2.2-incubating/blur-core/src/main/java/org/apache/blur/manager/writer/BlurIndexSimpleWriter.java#L303 > > >>> > > >>> That once the new index is available it is swapped into the index ref > > >>> object and the old one is sent to the index closer. Once the ref to > > the > > >>> index are low enough it closes the index. Or at least it should. > > >>> > > >>> I will continue looking into the problem but I don't have a solution > > for > > >>> you yet. > > >>> > > >>> Aaron > > >>> > > >>> > > >>> > > >>> > > > >>> > > > >>> > *Exception(message:Unknown error during rewrite, > > >>> > stackTraceStr:java.io.IOException: Stream closed* > > >>> > at > > >>> org.apache.hadoop.hdfs.DFSInputStream.pread(DFSInputStream.java:1385) > > >>> > at > > org.apache.hadoop.hdfs.DFSInputStream.read(DFSInputStream.java:1374) > > >>> > at > > >>> > org.apache.hadoop.fs.FSDataInputStream.read(FSDataInputStream.java:89) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.blur.store.hdfs.HdfsIndexInput.readInternal(HdfsIndexInput.java:62) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.blur.store.buffer.ReusedBufferedIndexInput.readBytes(ReusedBufferedIndexInput.java:167) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.blur.store.buffer.ReusedBufferedIndexInput.readBytes(ReusedBufferedIndexInput.java:122) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.blur.store.hdfs.MmapCacheIndexInput.readAndcache(MmapCacheIndexInput.java:24) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.blur.store.blockcache_v2.CacheIndexInput.fillNormally(CacheIndexInput.java:354) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.blur.store.blockcache_v2.CacheIndexInput.fill(CacheIndexInput.java:379) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.blur.store.blockcache_v2.CacheIndexInput.tryToFill(CacheIndexInput.java:297) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.blur.store.blockcache_v2.CacheIndexInput.readByte(CacheIndexInput.java:151) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.blur.lucene.warmup.TraceableIndexInput.readByte(TraceableIndexInput.java:62) > > >>> > at org.apache.lucene.store.DataInput.readVInt(DataInput.java:108) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.lucene.codecs.BlockTreeTermsReader$FieldReader$SegmentTermsEnum$Frame.loadBlock(BlockTreeTermsReader.java:2366) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.lucene.codecs.BlockTreeTermsReader$FieldReader$SegmentTermsEnum.seekCeil(BlockTreeTermsReader.java:1949) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.blur.index.ExitableReader$ExitableTermsEnum.seekCeil(ExitableReader.java:250) > > >>> > at > > >>> > > > >>> > > > org.apache.lucene.index.FilteredTermsEnum.next(FilteredTermsEnum.java:225) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.lucene.search.TermCollectingRewrite.collectTerms(TermCollectingRewrite.java:78) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.lucene.search.ConstantScoreAutoRewrite.rewrite(ConstantScoreAutoRewrite.java:95) > > >>> > at > > >>> > > > >>> > > > >>> > > > org.apache.lucene.search.MultiTermQuery$ConstantScoreAutoRewrite.rewrite(MultiTermQuery.java:220) > > >>> > at > > >>> > > org.apache.lucene.search.MultiTermQuery.rewrite(MultiTermQuery.java:288) > > >>> > at > > org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:412) > > >>> > at > > org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:412) > > >>> > at > > org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:412) > > >>> > at > > >>> > > > >>> > On Mon, May 9, 2016 at 4:42 PM, Ravikumar Govindarajan < > > >>> > ravikumar.govindarajan@gmail.com> wrote: > > >>> > > > >>> > > One extra info we gleaned from the logs... > > >>> > > > > >>> > > 1. Merge Starts & is about to complete > > >>> > > 2. Searcher is opened > > >>> > > 3. Merge Completes > > >>> > > 4. Ref-count drops to 0 in IndexReader > > >>> > > 5. IndexReader closed while Searcher is still open > > >>> > > > > >>> > > This seems to be the main pattern for causing the Exception > > >>> > > > > >>> > > -- > > >>> > > Ravi > > >>> > > > > >>> > > On Mon, May 9, 2016 at 3:08 PM, Ravikumar Govindarajan < > > >>> > > ravikumar.govindarajan@gmail.com> wrote: > > >>> > > > > >>> > >> Thanks Aaron... > > >>> > >> > > >>> > >> Just a quick question. Lucene itself has ref-counting to close > > it's > > >>> > >> readers no? Or Blur has it's own logic to handle it? > > >>> > >> > > >>> > >> -- > > >>> > >> Ravi > > >>> > >> > > >>> > >> On Fri, May 6, 2016 at 7:56 PM, Aaron McCurry < > amccurry@gmail.com > > > > > >>> > wrote: > > >>> > >> > > >>> > >>> Likely yes. If have a few minutes this weekend I can look > > through > > >>> that > > >>> > >>> version and see if I can point you in the right direction. > > >>> > >>> > > >>> > >>> On Fri, May 6, 2016 at 8:46 AM, Ravikumar Govindarajan < > > >>> > >>> ravikumar.govindarajan@gmail.com> wrote: > > >>> > >>> > > >>> > >>> > Sometimes during an ongoing search we receive an > > >>> > >>> > IndexReaderClosedException... > > >>> > >>> > > > >>> > >>> > We are on an older version of Blur (0.2.2). Has this been > fixed > > >>> in > > >>> > >>> newer > > >>> > >>> > versions or we have been using it wrongly? > > >>> > >>> > > > >>> > >>> > > *stackTraceStr:org.apache.lucene.store.AlreadyClosedException: > > >>> this > > >>> > >>> > IndexReader cannot be used anymore as one of its child > readers > > >>> was > > >>> > >>> closed* > > >>> > >>> > at > > >>> > > org.apache.lucene.index.IndexReader.ensureOpen(IndexReader.java:257) > > >>> > >>> > at > > >>> > >>> > > > >>> > >>> > > > >>> > >>> > > >>> > > > >>> > > > org.apache.lucene.index.FilterAtomicReader.fields(FilterAtomicReader.java:380) > > >>> > >>> > at > > >>> > >>> > > > >>> > >>> > > > >>> > >>> > > >>> > > > >>> > > > org.apache.blur.index.ExitableReader$ExitableFilterAtomicReader.fields(ExitableReader.java:81) > > >>> > >>> > at > > >>> > >>> > > > >>> > >>> > > > >>> > >>> > > >>> > > > >>> > > > org.apache.lucene.search.TermCollectingRewrite.collectTerms(TermCollectingRewrite.java:52) > > >>> > >>> > at > > >>> > >>> > > > >>> > >>> > > > >>> > >>> > > >>> > > > >>> > > > org.apache.lucene.search.ConstantScoreAutoRewrite.rewrite(ConstantScoreAutoRewrite.java:95) > > >>> > >>> > at > > >>> > >>> > > > >>> > >>> > > > >>> > >>> > > >>> > > > >>> > > > org.apache.lucene.search.MultiTermQuery$ConstantScoreAutoRewrite.rewrite(MultiTermQuery.java:220) > > >>> > >>> > at > > >>> > >>> > > >>> > > > >>> > > org.apache.lucene.search.MultiTermQuery.rewrite(MultiTermQuery.java:288) > > >>> > >>> > at > > >>> > > org.apache.lucene.search.BooleanQuery.rewrite(BooleanQuery.java:412) > > >>> > >>> > > > >>> > >>> > > >>> > >> > > >>> > >> > > >>> > > > > >>> > > > >>> > > >> > > >> > > > > > > --001a113b029428d54705343447b2--