lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
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<> 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

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 --


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message