Do you use the IndexWriter as mutex in a synchronized() block? This is not supported and may hang. Never lock on IndexWriter instances. IndexWriter itself is thread safe.
----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Christopher Tignor [mailto:ctig...@thinkmap.com] > Sent: Friday, October 16, 2009 6:50 PM > To: java-user > Subject: IndexWriter optimize() deadlock > > Hello, > > I am trying to track down the cause of my code hanging on calling > IndexWriter.optimize() at its doWait() method. > It appears, thus that it is watiing on other merges to happen which is a > bit > confusing to me: > > My application is a simple producer consumer model where documents are > added > to a queue by producers and then one consumer with one indexwriter (the > only > in the application) periodically calls addDocument() on a batch of these > jobs and then calls optimize(), commit(). and then close(). There is only > one thread running the consumer so I am confused as to how the indexwriter > might be deadlocking itself. Indeed this is the only thread active when > the > deadlock occurs so it seems to be a problem of reentry. > > Importantly, the deadlocking occurs only when the thread is trying to > shutdown - that is the Thread running this lucene consumer has a Future > that > has had its cancel(true) interrupting method called. Is it possible that > an > internal Lucene lock is obtained during addDocument() and on interruption > is > never released so the subsequent optimize() call hangs? This doesn't > appear > to be happening... > > Any help appreciated. > > thanks, > > C>T> > > what might I be missing here? > > -- > TH!NKMAP > > Christopher Tignor | Senior Software Architect > 155 Spring Street NY, NY 10012 > p.212-285-8600 x385 f.212-285-8999 --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org