lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dawid Weiss <>
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(
        - waiting to lock <L5> (a org.apache.lucene.index.IndexWriter)
        at org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.toString(
        at org.apache.lucene.util.LuceneTestCase.getRandom(
        at org.apache.lucene.index.TestTransactions.access$100(
        at org.apache.lucene.index.TestTransactions$RandomFailure.eval(
        - locked <L4> (a
        - locked <L4> (a
        at org.apache.lucene.codecs.lucene40.Lucene40FieldInfosWriter.write(
        at org.apache.lucene.index.SegmentMerger.mergeFieldInfos(
        at org.apache.lucene.index.SegmentMerger.merge(
        at org.apache.lucene.index.IndexWriter.mergeMiddle(
        at org.apache.lucene.index.IndexWriter.merge(
        at org.apache.lucene.index.ConcurrentMergeScheduler.doMerge(
        at org.apache.lucene.index.ConcurrentMergeScheduler$
"Lucene Merge Thread #0":
        - waiting to lock <L4> (a
        at org.apache.lucene.index.IndexFileDeleter.refresh(
        at org.apache.lucene.index.IndexWriter.merge(
        - locked <L5> (a org.apache.lucene.index.IndexWriter)
        at org.apache.lucene.index.ConcurrentMergeScheduler.doMerge(
        at org.apache.lucene.index.ConcurrentMergeScheduler$

A classic, isn't it?


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

View raw message