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 6619110E57 for ; Tue, 6 Jan 2015 18:24:44 +0000 (UTC) Received: (qmail 27239 invoked by uid 500); 6 Jan 2015 18:24:43 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 27173 invoked by uid 500); 6 Jan 2015 18:24:43 -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 27162 invoked by uid 99); 6 Jan 2015 18:24:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Jan 2015 18:24:42 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [209.85.192.181] (HELO mail-pd0-f181.google.com) (209.85.192.181) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Jan 2015 18:24:16 +0000 Received: by mail-pd0-f181.google.com with SMTP id v10so30947521pde.40 for ; Tue, 06 Jan 2015 10:22:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-type:message-id:mime-version :subject:date:references:to:in-reply-to; bh=T2sP+Hdc2bnos5VnIsoRkLINbrdkxfav8+b6gUk7bDs=; b=JvUiQ9+7O0OaQ/P/FPfkAB9pyg9FuG61X4VGEKQ2T6f0Y9OHEJ3OSs18w5/2cGMsfm F/TJHAQTN2WxJfH8YoWwgaPB9QDhZWLBo5IDyUEP4qpdmV9Pw2NyL8qwQ01G4c+nV/5g Hy04PLD1/G+zxsHFQO2MpZjon7tiSe9CderRx7E7Gq0iLz4AGWBX6g3QBmh4iPly+lWS gI551xjrerZVGCBeh0tfwzJiO+UdUiOe2GQXeaPErEmn6axZ1Hr/mjpf4RAEWvni3muE xCTl+JT9daexhoNGFbCqit8ozrJL8kX3MHvp3nT93iL52F50umMDgxDqmFGxBihPWuwU hNVw== X-Gm-Message-State: ALoCoQmxBIHfnd58k1otK3JcIC7mABeGJJOjYD8Ox9OZnvqpW+FM6RL7bNaDoXq+KKSBrMbCi7Ya X-Received: by 10.66.155.99 with SMTP id vv3mr1475315pab.17.1420568544464; Tue, 06 Jan 2015 10:22:24 -0800 (PST) Received: from [192.168.5.181] (wsip-70-168-54-2.sd.sd.cox.net. [70.168.54.2]) by mx.google.com with ESMTPSA id w8sm57672614pdl.23.2015.01.06.10.22.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Jan 2015 10:22:23 -0800 (PST) From: Brian Call Content-Type: multipart/alternative; boundary="Apple-Mail=_C62147E1-7A43-4BED-9847-DC142C96FA59" Message-Id: <7B28A499-CAFC-4694-80BF-D4DD31DA2864@soterawireless.com> Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: AlreadyClosedException on new index Date: Tue, 6 Jan 2015 10:22:22 -0800 References: <80652B83-2E99-4494-AA68-CFFC854E2EC9@soterawireless.com> <179B89A5-BF46-4DA8-AD16-66FFCB14D65F@soterawireless.com> To: java-user@lucene.apache.org In-Reply-To: X-Mailer: Apple Mail (2.1993) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_C62147E1-7A43-4BED-9847-DC142C96FA59 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 No exception at all=E2=80=A6 and that=E2=80=99s the crazy part. I create = a new IndexWriter and then immediately create a new SearcherManager = using that freshly-created IndexWriter. Granted, I don=E2=80=99t = actually do anything with the IndexWriter before passing it to the = SearcherManager, but no exceptions are thrown either.=20 -Brian > On Jan 6, 2015, at 9:55 AM, Ian Lea wrote: >=20 > Presumably no exception is thrown from the new IndexWriter(....) call? > I'd double check that, and try some harmless method call on the > writer and make sure that works. And run CheckIndex against the > index. >=20 >=20 > -- > Ian. >=20 >=20 > On Tue, Jan 6, 2015 at 5:05 PM, Brian Call > > = wrote: >> Hi Tomoko, >>=20 >> Thank you for your response! We=E2=80=99ve actually never seen this = before in the three+ years of developing using Lucene 3.6.x. The only = time we=E2=80=99ve ever seen this kind of exception is once recently in = a running production system and it caught me way off guard. We=E2=80=99re = deploying on Suse linux (enterprise), and jdk1.7. >>=20 >> Our application creates and deletes indices within the context of a = single thread so I don=E2=80=99t think another thread is abruptly = closing the index. All index open/close operations are always done = sequentially in the context of one thread as operation requests are = received. >>=20 >> Blessings, >> Brian >>=20 >>=20 >>=20 >>> On Jan 6, 2015, at 2:16 AM, Tomoko Uchida = wrote: >>>=20 >>> Hi, >>>=20 >>> How often does this error occur? >>> You do not tell the lucene version, but I guess you use lucene 3.x >>> according to the stack trace... >>> IndexWriter would not be closed until IndexWriter.close() method is = called >>> explicitly. >>> = https://github.com/apache/lucene-solr/blob/lucene_solr_3_6_2/lucene/core/s= rc/java/org/apache/lucene/index/IndexWriter.java = = > >>>=20 >>> Do you have custom codes wrapping lucene objects? There can be any = codes >>> which call IndexWriter.close() unexpectedly? >>>=20 >>> If your application seems to have no problem, you need to share more >>> information including lucene version and system environments. >>>=20 >>> Regards, >>> Tomoko >>>=20 >>>=20 >>> 2015-01-06 8:32 GMT+09:00 Brian Call = >>: >>>=20 >>>> Hi Guys, >>>>=20 >>>> So I=E2=80=99m seeing a problem in production that is very bizarre = and I wanted to >>>> see if anyone else has encountered this issue and/or has a = suggestion or >>>> fix. Here goes: >>>>=20 >>>> We create a wrapper around an index and searcher manager to = encapsulate >>>> both. First we create the IndexWriter and then immediately after = create the >>>> SearcherManager, like this: >>>>=20 >>>> indexWriter =3D new IndexWriter(indexDirectory, getWriterConfig()); >>>> searcherManager =3D new SearcherManager(indexWriter, true, new >>>> ExecutorSearcherFactory()); >>>>=20 >>>>=20 >>>> During construction of the SearcherManager this is thrown: >>>>=20 >>>> Caused by: org.apache.lucene.store.AlreadyClosedException: this >>>> IndexWriter is closed >>>> at >>>> = org.apache.lucene.index.IndexWriter.ensureOpen(IndexWriter.java:766) >>>> at >>>> = org.apache.lucene.index.IndexWriter.getDirectory(IndexWriter.java:1909) >>>> at >>>> = com.triagewireless.h1s.session.data.index.LuceneIndexMergeScheduler.getInd= exDirectory(LuceneIndexMergeScheduler.java:162) >>>> at >>>> = com.triagewireless.h1s.session.data.index.LuceneIndexMergeScheduler.access= $000(LuceneIndexMergeScheduler.java:31) >>>> at >>>> = com.triagewireless.h1s.session.data.index.LuceneIndexMergeScheduler$MergeT= ask.equals(LuceneIndexMergeScheduler.java:127) >>>> at >>>> = java.util.concurrent.ArrayBlockingQueue.contains(ArrayBlockingQueue.java:4= 97) >>>> at >>>> = com.triagewireless.h1s.session.data.index.LuceneIndexMergeScheduler.merge(= LuceneIndexMergeScheduler.java:148) >>>> at >>>> = org.apache.lucene.index.IndexWriter.maybeMerge(IndexWriter.java:2740) >>>> at >>>> = org.apache.lucene.index.IndexWriter.maybeMerge(IndexWriter.java:2734) >>>> at >>>> org.apache.lucene.index.IndexWriter.getReader(IndexWriter.java:457) >>>> at >>>> org.apache.lucene.index.IndexWriter.getReader(IndexWriter.java:399) >>>> at = org.apache.lucene.index.IndexReader.open(IndexReader.java:296) >>>> at >>>> = org.apache.lucene.search.SearcherManager.(SearcherManager.java:82) >>>> at >>>> = com.triagewireless.h1s.session.data.index.LuceneIndex.initNoCache(LuceneIn= dex.java:312) >>>> at >>>> = com.triagewireless.h1s.session.data.index.LuceneIndex.init(LuceneIndex.jav= a:270) >>>> at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown = Source) >>>> at >>>> = sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm= pl.java:43) >>>> at java.lang.reflect.Method.invoke(Method.java:606) >>>> at >>>> = org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPost= Processor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.j= ava:346) >>>> at >>>> = org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPost= Processor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPos= tProcessor.java:299) >>>> at >>>> = org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPost= Processor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostPro= cessor.java:132) >>>> ... 57 more >>>>=20 >>>>=20 >>>> Why? No other threads are acting on this index, etc. The index = writer was >>>> just created so how could it already be closed? >>>>=20 >>>> I=E2=80=99m completely baffled on this one guys=E2=80=A6 so many = thanks in advance for >>>> your help! I=E2=80=99ll take any suggestions on a possible = mitigation too if anyone >>>> thinks of any. >>>>=20 >>>>=20 >>>> Blessings, >>>> Brian Call >>>> Manager, Systems Software Development >>>> Work: +1 (619) 373-4840 | Cell: +1 (619) 344-1013 >>>>=20 >>>> = >> = Sotera Wireless, Inc. >>>> 10020 Huennekens Street San Diego, CA 92121, USA >>>> Phone: +1 (858) 427-4620 | Fax: +1 (858) 999-2487 >>>>=20 >>>> PRIVILEGED AND CONFIDENTIAL COMMUNICATION: This electronic = transmission, >>>> and any documents attached hereto, may contain confidential and/or = legally >>>> privileged information. The information is intended only for use by = the >>>> recipient named above. If you have received this electronic message = in >>>> error, please notify the sender and delete the electronic message. = Any >>>> disclosure, copying, distribution, or use of the contents of = information >>>> received in error is strictly prohibited. >>=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org = > For additional commands, e-mail: java-user-help@lucene.apache.org = --Apple-Mail=_C62147E1-7A43-4BED-9847-DC142C96FA59--