lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject Re: hudson hung
Date Tue, 01 May 2012 13:59:51 GMT
I tried to enforce a Timeout using this code, added to my top-level test
case (didn't try yet on LTC):

    @Rule
    public static Timeout globalTimeout = new Timeout(100000); // 100
seconds

This comes straight from JUnit. I don't have the randomizedtesting jar in
my project, so I couldn't add the @Timeout annotation.

When I set it to a low value (20 ms), many tests failed as expected.
However, on one occasion, a test took 135 seconds, as reported by JUnit in
eclipse, and still didn't fail ! I don't know what it means though -- the
test usually doesn't take more than 15 seconds to run, so perhaps the
computer was busy, and therefore even the timeout thread didn't get the
chance to fail ... or perhaps the time reported by eclipse is inaccurate.

Anyway, perhaps try with that (just add it to LTC anywhere).

Shai

On Tue, May 1, 2012 at 4:05 PM, Michael McCandless <
lucene@mikemccandless.com> wrote:

> Hmm, as a test, I tried adding @Timeout(millis=100000) to
> LuceneTestCase, ie 100 seconds, which I think should not trigger on
> any core tests today.
>
> That should then apply to all subclasses of LuceneTestCase right?  Ie
> all tests will be aborted after 100 seconds...
>
> But, something is wrong: I get lots of quick (ie much less than 100
> seconds) failures like this:
>
>   [junit4] Suite: org.apache.lucene.util.TestRamUsageEstimatorOnWildAnimals
>   [junit4] ERROR   0.00s J2 | TestRamUsageEstimatorOnWildAnimals (suite)
>   [junit4]    > Throwable #1: java.lang.RuntimeException: Interrupted
> while waiting for worker? Weird.
>   [junit4]    >        at
> __randomizedtesting.SeedInfo.seed([329191043FC42BEA]:0)
>   [junit4]    >        at
>
> com.carrotsearch.randomizedtesting.RandomizedRunner.runAndWait(RandomizedRunner.java:786)
>   [junit4]    >        at
>
> com.carrotsearch.randomizedtesting.RandomizedRunner.access$900(RandomizedRunner.java:131)
>   [junit4]    >        at
>
> com.carrotsearch.randomizedtesting.RandomizedRunner$3.evaluate(RandomizedRunner.java:689)
>   [junit4]    >        at
>
> com.carrotsearch.randomizedtesting.RandomizedRunner$4.evaluate(RandomizedRunner.java:723)
>   [junit4]    >        at
>
> com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:734)
>   [junit4]    >        at
>
> org.apache.lucene.util.UncaughtExceptionsRule$1.evaluate(UncaughtExceptionsRule.java:75)
>   [junit4]    >        at
>
> org.apache.lucene.util.StoreClassNameRule$1.evaluate(StoreClassNameRule.java:38)
>   [junit4]    >        at
>
> org.apache.lucene.util.SystemPropertiesInvariantRule$1.evaluate(SystemPropertiesInvariantRule.java:69)
>   [junit4]    >        at
>
> com.carrotsearch.randomizedtesting.RandomizedRunner.runSuite(RandomizedRunner.java:604)
>   [junit4]    >        at
>
> com.carrotsearch.randomizedtesting.RandomizedRunner.access$400(RandomizedRunner.java:131)
>   [junit4]    >        at
>
> com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:550)
>   [junit4]    > Caused by: java.lang.InterruptedException
>   [junit4]    >        at java.lang.Object.wait(Native Method)
>   [junit4]    >        at java.lang.Thread.join(Thread.java:1266)
>   [junit4]    >        at
>
> com.carrotsearch.randomizedtesting.RandomizedRunner.runAndWait(RandomizedRunner.java:776)
>   [junit4]    >        ... 10 more
>   [junit4]    >
>   [junit4] Completed on J2 in 0.34s, 1 test, 1 error <<< FAILURES!
>   [junit4]
>   [junit4] May 01, 2012 9:02:18 AM
>
> com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.eventbus.EventBus
> dispatch
>   [junit4] SEVERE: Could not dispatch event:
>
> com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedSuiteResultEvent@6637b753
> to handler [wrapper public void
>
> com.carrotsearch.ant.tasks.junit4.listeners.TextReport.onSuiteResult(com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedSuiteResultEvent)]
>   [junit4] java.lang.reflect.InvocationTargetException
>   [junit4]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>   [junit4]     at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>   [junit4]     at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   [junit4]     at java.lang.reflect.Method.invoke(Method.java:601)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:68)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.eventbus.EventBus.post(EventBus.java:264)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatingListener.receiveSuiteEnd(AggregatingListener.java:130)
>   [junit4]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>   [junit4]     at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>   [junit4]     at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   [junit4]     at java.lang.reflect.Method.invoke(Method.java:601)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:68)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.eventbus.EventBus.post(EventBus.java:264)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.LocalSlaveStreamHandler.pumpEvents(LocalSlaveStreamHandler.java:139)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.LocalSlaveStreamHandler$1.run(LocalSlaveStreamHandler.java:81)
>   [junit4]     at java.lang.Thread.run(Thread.java:722)
>   [junit4] Caused by: java.lang.RuntimeException: Unfinished
> test?org.apache.lucene.util.TestRamUsageEstimatorOnWildAnimals,
>
> testOverflowMaxChainLength(org.apache.lucene.util.TestRamUsageEstimatorOnWildAnimals)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedTestResultEvent.getEventStream(AggregatedTestResultEvent.java:87)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.listeners.TextReport.format(TextReport.java:411)
>   [junit4]     at
>
> com.carrotsearch.ant.tasks.junit4.listeners.TextReport.onSuiteResult(TextReport.java:216)
>   [junit4]     ... 22 more
>
> Not sure what's up...
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
> On Mon, Apr 30, 2012 at 6:24 PM, Dawid Weiss
> <dawid.weiss@cs.put.poznan.pl> wrote:
> >> just to clarify: your'e saying that if we put that anotation on a class,
> >> like LuceneTestCase, it will apply to any test *method* in that class
> (or
> >> subclasses) ... and presumably if a subclass uses that anotation with a
> >> diff millis value, that will override the superclass.
> >
> > Correct. You can also apply it to a particular method to have
> > per-method adjustment. In fact, @Timeout is somewhat redundant since
> > @Test also has a "timeout" attribute... and this will also work. But I
> > thought a consistent @Timeout would be nicer (applied to class,
> > method, wherever). Up to your taste I guess.
> >
> > There is one issue with timeouts -- they apply to test cases _only_,
> > not to suite-level code (@BeforeClass, @ClassRules). I don't know if
> > this qualifies as a bug or feature -- haven't developed that gut
> > feeing yet...
> >
> > Dawid
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: dev-help@lucene.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

Mime
View raw message