lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: deadlock in indexing
Date Wed, 29 Jul 2009 09:48:56 GMT
On Tue, Jul 28, 2009 at 5:10 PM, Chengdu
Huang<chengdu.huang@patterninsight.com> wrote:

> For the deadlock, I also think it has something to do with merging.

Right, what's happening here is the ConcurrentMergeScheduler, which
runs BG threads to do merging, has a max thread count (default 3) that
it's allowed to run at once.

Because you had sync'd on writer, each of these threads was blocked on
trying to start its merge (they invoke a synchronized method on
IndexWriter).

Once the max number of threads is outstanding,
ConcurrentMergeScheduler forcefully idles the main threads, waiting
for the BG thread count to drop back down, which in your case will
never happen.

Synchronizing on your own private Object will fix it.

And I agree: we should update the javadocs to spell out IndexWriter's
thread safety, including "you shouldn't synchronize on IndexWriter
externally".  Looks like Simon just opened the issue for this --
thanks!

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message