On Thu, Dec 9, 2010 at 10:32 AM, Shai Erera <[email protected]> wrote:
> 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.

Hmm why no repro command?  That's no good.  Maybe if a test fails only
due to threads other than main, we fail to print repro?

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

Good, I agree!  And I think also change assert to tolerate numSearch
== 0?  Ie it's fine if there are no hits if no searches succeeded in
running...

You wanna fix?

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

Good!  Poor, starving threads....

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to