Race condition in TimerTask KillThread test

David Holmes david.holmes at oracle.com
Mon Nov 7 01:49:44 UTC 2011


On 5/11/2011 1:52 AM, Gary Adams wrote:
> I'm taking a look at some older timing based bugs that may cause problems
> on slower machines
>
> 6818464: TEST_BUG: Timeout values in several java/util tests are
> insufficient
>
> I'd like to split this bug into two, based on the example problems that are
> mentioned in the bug report.
>
> The first example in
> java/util/Timer/KillThread.java
<snip - discussed in other email>

> In the second example the test instructions present a timeout
> to be enforced by the outer test harness. e.g.
> @run main/timeout=20 StoreDeadLock
>
> This type of test limit is easily addressed on slower machines
> using the test harness timefactor to scale the acceptable
> test run time.

Not sure that is the case in general. Use of timefactor was suggested 
when running in Xcomp mode because the top-level test configuration 
knows it is running the tests in Xcomp mode. But in general the test 
harness does not know when  any given test is running on a slower 
machine, or a not-so-slow but heavily loaded machine.

David
-----


> I'll attempt a simple fix for the KillThread case by replacing :
>
> Thread.sleep(100);
>
> with a simple loop
>
> do {
> Thread.sleep(100);
> } while (waiting);
>
> where the TimerTask runnable will clear the flag
> with "waiting = false " once it has been launched.
>
>
>



More information about the core-libs-dev mailing list