lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject TestSearchWithThreads failure
Date Thu, 09 Dec 2010 15:32:01 GMT
Hi

I've hit this:

    [junit] Testsuite: org.apache.lucene.search.TestSearchWithThreads
    [junit] Testcase:
test(org.apache.lucene.search.TestSearchWithThreads):     FAILED
    [junit] Some threads threw uncaught exceptions!
    [junit] junit.framework.AssertionFailedError: Some threads threw
uncaught exceptions!
    [junit]     at
org.apache.lucene.util.LuceneTestCase$LuceneTestCaseRunner.runChild(LuceneTestCase.java:1039)
    [junit]     at
org.apache.lucene.util.LuceneTestCase$LuceneTestCaseRunner.runChild(LuceneTestCase.java:977)
    [junit]     at
org.apache.lucene.util.LuceneTestCase.tearDown(LuceneTestCase.java:478)
    [junit]
    [junit]
    [junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 1.487 sec
    [junit]
    [junit] ------------- Standard Error -----------------
    [junit] The following exceptions were thrown by threads:
    [junit] *** Thread: Thread-98 ***
    [junit] java.lang.AssertionError:
    [junit]     at org.junit.Assert.fail(Assert.java:91)
    [junit]     at org.junit.Assert.assertTrue(Assert.java:43)
    [junit]     at org.junit.Assert.assertTrue(Assert.java:55)
    [junit]     at
org.apache.lucene.search.TestSearchWithThreads$1.run(TestSearchWithThreads.java:88)
    [junit] *** Thread: Thread-100 ***
    [junit] java.lang.AssertionError:
    [junit]     at org.junit.Assert.fail(Assert.java:91)
    [junit]     at org.junit.Assert.assertTrue(Assert.java:43)
    [junit]     at org.junit.Assert.assertTrue(Assert.java:55)
    [junit]     at
org.apache.lucene.search.TestSearchWithThreads$1.run(TestSearchWithThreads.java:88)
    [junit] ------------- ---------------- ---------------
    [junit] TEST org.apache.lucene.search.TestSearchWithThreads FAILED

No 'reproduce' command, and I ran the test alone as well as test-core
multiple times since and wasn't able to reproduce since.

The failure is on this line: assertTrue(totHits > 0);

Looking in the code, there are two possible causes I can think of:

1) The while() loop isn't executed because the machine hiccup or something
and stopAt reached before reaching while() ... or failed.get() is true.
--> we need to fix the assert in any case I think, to assert !failed.get()
&& totalHits > 0 ... otherwise it will fail, potentially masking the
original failure.
--> we need to set a boolean inside the loop, e.g. "ran=true" and
incorporate that in the assert.

2) The test uses the new TotalHitCountCollector, and perhaps uncovers a bug
--- I think it's not very likely.

Also, I'd change the test to first create the array of threads, then compute
stopAt and then start() all of them. Currently, the test spends time
constructing a Thread object, and the last thread accumulates that time and
doesn't have much time left to actually run.

Shai

Mime
View raw message