lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jagadesh Nomula <Jagadesh.Nom...@MetaLINCS.com>
Subject Deadlock when multi-threading DocumentsWriter
Date Mon, 28 Jul 2008 22:00:18 GMT
Would anyone be having any insight into deadlock issues, when running DocumentsWriter.java
from multiple threads ?. I am trying to port ParallelWriter.java code to new codebase of DocumentsWriter.java
and IndexWriter. I am doing this by splitting, DocumentsWriter.addDocument call into two methods
unsynchronized methods, doGetThreadState and finishDocWithThreadState. doGetThreadState just
calls the synchronized getThreadState method and returns a thread state to be used by finishDocWithThreadState,
which inverts the document and flushes it.  The code base is semantically equivalent to addDocument
method in DocumentsWriter, the only variation being, call to doGetThreadState executed from
a synched block in ParallelWriter to maintain the consistency of same doc-ids in parallelWriter.

You would imagine that, this code would work without any issues, but it runs into a deadlock.
The excerpt of suspicious calls is:

== Thread ConnectionThreadGroup-26491.pool-8-thread-1 ===> java.lang.Object.wait(Native
Method)
        java.lang.Object.wait(Object.java:485)
        org.apache.lucene.index.DocumentsWriter.pauseAllThreads(DocumentsWriter.java:507)
        org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:2670)
        org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:2660)
        org.apache.lucene.index.IndexWriter.finishDoc(IndexWriter.java:1601)
        org.apache.lucene.index.ParallelWriter$ProcessWorker.run(ParallelWriter.java:464)
        java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        java.lang.Thread.run(Thread.java:619)


=======================================
== Thread ConnectionThreadGroup-26491.pool-3-thread-6 ===> java.lang.Object.wait(Native
Method)
        java.lang.Object.wait(Object.java:485)
        org.apache.lucene.index.DocumentsWriter.getThreadState(DocumentsWriter.java:2420)
        org.apache.lucene.index.DocumentsWriter.doGetThreadState(DocumentsWriter.java:2532)
        org.apache.lucene.index.IndexWriter.getThreadState(IndexWriter.java:1564)
        org.apache.lucene.index.ParallelWriter$ThreadStateWorker.call(ParallelWriter.java:425)
        org.apache.lucene.index.ParallelWriter$ThreadStateWorker.call(ParallelWriter.java:405)
        java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        java.util.concurrent.FutureTask.run(FutureTask.java:138)
        java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        java.lang.Thread.run(Thread.java:619)

Any info, that I might be overlooking or any comments would be of great help to me in resolving
this. Thanks in advance for your help.

Jagdish



Mime
View raw message