lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dawid Weiss <dawid.we...@gmail.com>
Subject toString on Thread
Date Thu, 01 Mar 2012 22:20:04 GMT
Overriding toString on a Thread is not a good idea. Can I remove it or
at least make it simpler in ConcurrentMergeScheduler? This override
caused a fantastic deadlock -- an interesting possibility I didn't
think of -- again, when dumping threads (for the exception string)
Thread.toString was invoked from what I thought was an isolated
monitor (and it was); only toString had its own monitors underneath
and here's what happened (simplified):

"Lucene Merge Thread #1":
        at org.apache.lucene.index.IndexWriter.segString(IndexWriter.java:3764)
        - waiting to lock <L5> (a org.apache.lucene.index.IndexWriter)
        at org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.toString(ConcurrentMergeScheduler.java:499)
        ...
        at org.apache.lucene.util.LuceneTestCase.getRandom(LuceneTestCase.java:276)
        at org.apache.lucene.index.TestTransactions.access$100(TestTransactions.java:33)
        at org.apache.lucene.index.TestTransactions$RandomFailure.eval(TestTransactions.java:40)
        at org.apache.lucene.store.MockDirectoryWrapper.maybeThrowDeterministicException(MockDirectoryWrapper.java:688)
        - locked <L4> (a org.apache.lucene.store.MockDirectoryWrapper)
        at org.apache.lucene.store.MockDirectoryWrapper.createOutput(MockDirectoryWrapper.java:415)
        - locked <L4> (a org.apache.lucene.store.MockDirectoryWrapper)
        at org.apache.lucene.codecs.lucene40.Lucene40FieldInfosWriter.write(Lucene40FieldInfosWriter.java:56)
        at org.apache.lucene.index.SegmentMerger.mergeFieldInfos(SegmentMerger.java:194)
        at org.apache.lucene.index.SegmentMerger.merge(SegmentMerger.java:109)
        at org.apache.lucene.index.IndexWriter.mergeMiddle(IndexWriter.java:3623)
        at org.apache.lucene.index.IndexWriter.merge(IndexWriter.java:3257)
        at org.apache.lucene.index.ConcurrentMergeScheduler.doMerge(ConcurrentMergeScheduler.java:382)
        at org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.run(ConcurrentMergeScheduler.java:451)
"Lucene Merge Thread #0":
        at org.apache.lucene.store.MockDirectoryWrapper.listAll(MockDirectoryWrapper.java:695)
        - waiting to lock <L4> (a org.apache.lucene.store.MockDirectoryWrapper)
        at org.apache.lucene.index.IndexFileDeleter.refresh(IndexFileDeleter.java:345)
        at org.apache.lucene.index.IndexWriter.merge(IndexWriter.java:3272)
        - locked <L5> (a org.apache.lucene.index.IndexWriter)
        at org.apache.lucene.index.ConcurrentMergeScheduler.doMerge(ConcurrentMergeScheduler.java:382)
        at org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.run(ConcurrentMergeScheduler.java:451)

A classic, isn't it?

Dawid

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


Mime
View raw message