You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Daan Hoogland <da...@gmail.com> on 2013/08/06 17:16:35 UTC
weird test failure
H,
I just had a time skew that seems impossible:
if in the folowing test the sleep is 1000 it reports a failure saying
the duration was 999. now I see at least some clock ticks around it so
whats heppening? An overeager optimizer, maybe? I had to set it to
1001 to make it work. This is not new code, it has been there since
jan 24! So i ran it a few times.
public class TestProfiler extends Log4jEnabledTestCase {
protected final static Logger s_logger =
Logger.getLogger(TestProfiler.class);
@Test
public void testProfiler() {
s_logger.info("testProfiler() started");
Profiler pf = new Profiler();
pf.start();
try {
Thread.sleep(1001);
} catch (InterruptedException e) {
}
pf.stop();
s_logger.info("Duration : " + pf.getDuration());
Assert.assertTrue(pf.getDuration() >= 1000);
s_logger.info("testProfiler() stopped");
}
}
any clue welcome,
Daan
Re: weird test failure
Posted by Daan Hoogland <da...@gmail.com>.
ok, in the mean while please have another look at
https://reviews.apache.org/r/12849/ please?
On Wed, Aug 7, 2013 at 8:01 PM, Chiradeep Vittal
<Ch...@citrix.com> wrote:
> I'd say the test needs to be changed to allow for a negative skew.
>
> On 8/7/13 2:05 AM, "Daan Hoogland" <da...@gmail.com> wrote:
>
>>I under-kinda-stand,
>>
>>Does this mean I should live with the whole build failing for a while
>>once in a while? Meaning should I change this test and submit a patch
>>or is there some windows or java setting I should look at?
>>
>>On Tue, Aug 6, 2013 at 8:19 PM, Chiradeep Vittal
>><Ch...@citrix.com> wrote:
>>> Some insight here
>>> http://www.javatuning.com/why-is-thread-sleep-inherently-inaccurate/
>>>
>>>
>>> On 8/6/13 8:16 AM, "Daan Hoogland" <da...@gmail.com> wrote:
>>>
>>>>H,
>>>>
>>>>I just had a time skew that seems impossible:
>>>>
>>>>if in the folowing test the sleep is 1000 it reports a failure saying
>>>>the duration was 999. now I see at least some clock ticks around it so
>>>>whats heppening? An overeager optimizer, maybe? I had to set it to
>>>>1001 to make it work. This is not new code, it has been there since
>>>>jan 24! So i ran it a few times.
>>>>
>>>>public class TestProfiler extends Log4jEnabledTestCase {
>>>> protected final static Logger s_logger =
>>>>Logger.getLogger(TestProfiler.class);
>>>>
>>>> @Test
>>>> public void testProfiler() {
>>>> s_logger.info("testProfiler() started");
>>>>
>>>> Profiler pf = new Profiler();
>>>> pf.start();
>>>> try {
>>>> Thread.sleep(1001);
>>>> } catch (InterruptedException e) {
>>>> }
>>>> pf.stop();
>>>>
>>>> s_logger.info("Duration : " + pf.getDuration());
>>>>
>>>> Assert.assertTrue(pf.getDuration() >= 1000);
>>>>
>>>> s_logger.info("testProfiler() stopped");
>>>> }
>>>>}
>>>>
>>>>any clue welcome,
>>>>Daan
>>>
>
Re: weird test failure
Posted by Chiradeep Vittal <Ch...@citrix.com>.
I'd say the test needs to be changed to allow for a negative skew.
On 8/7/13 2:05 AM, "Daan Hoogland" <da...@gmail.com> wrote:
>I under-kinda-stand,
>
>Does this mean I should live with the whole build failing for a while
>once in a while? Meaning should I change this test and submit a patch
>or is there some windows or java setting I should look at?
>
>On Tue, Aug 6, 2013 at 8:19 PM, Chiradeep Vittal
><Ch...@citrix.com> wrote:
>> Some insight here
>> http://www.javatuning.com/why-is-thread-sleep-inherently-inaccurate/
>>
>>
>> On 8/6/13 8:16 AM, "Daan Hoogland" <da...@gmail.com> wrote:
>>
>>>H,
>>>
>>>I just had a time skew that seems impossible:
>>>
>>>if in the folowing test the sleep is 1000 it reports a failure saying
>>>the duration was 999. now I see at least some clock ticks around it so
>>>whats heppening? An overeager optimizer, maybe? I had to set it to
>>>1001 to make it work. This is not new code, it has been there since
>>>jan 24! So i ran it a few times.
>>>
>>>public class TestProfiler extends Log4jEnabledTestCase {
>>> protected final static Logger s_logger =
>>>Logger.getLogger(TestProfiler.class);
>>>
>>> @Test
>>> public void testProfiler() {
>>> s_logger.info("testProfiler() started");
>>>
>>> Profiler pf = new Profiler();
>>> pf.start();
>>> try {
>>> Thread.sleep(1001);
>>> } catch (InterruptedException e) {
>>> }
>>> pf.stop();
>>>
>>> s_logger.info("Duration : " + pf.getDuration());
>>>
>>> Assert.assertTrue(pf.getDuration() >= 1000);
>>>
>>> s_logger.info("testProfiler() stopped");
>>> }
>>>}
>>>
>>>any clue welcome,
>>>Daan
>>
Re: weird test failure
Posted by Daan Hoogland <da...@gmail.com>.
I under-kinda-stand,
Does this mean I should live with the whole build failing for a while
once in a while? Meaning should I change this test and submit a patch
or is there some windows or java setting I should look at?
On Tue, Aug 6, 2013 at 8:19 PM, Chiradeep Vittal
<Ch...@citrix.com> wrote:
> Some insight here
> http://www.javatuning.com/why-is-thread-sleep-inherently-inaccurate/
>
>
> On 8/6/13 8:16 AM, "Daan Hoogland" <da...@gmail.com> wrote:
>
>>H,
>>
>>I just had a time skew that seems impossible:
>>
>>if in the folowing test the sleep is 1000 it reports a failure saying
>>the duration was 999. now I see at least some clock ticks around it so
>>whats heppening? An overeager optimizer, maybe? I had to set it to
>>1001 to make it work. This is not new code, it has been there since
>>jan 24! So i ran it a few times.
>>
>>public class TestProfiler extends Log4jEnabledTestCase {
>> protected final static Logger s_logger =
>>Logger.getLogger(TestProfiler.class);
>>
>> @Test
>> public void testProfiler() {
>> s_logger.info("testProfiler() started");
>>
>> Profiler pf = new Profiler();
>> pf.start();
>> try {
>> Thread.sleep(1001);
>> } catch (InterruptedException e) {
>> }
>> pf.stop();
>>
>> s_logger.info("Duration : " + pf.getDuration());
>>
>> Assert.assertTrue(pf.getDuration() >= 1000);
>>
>> s_logger.info("testProfiler() stopped");
>> }
>>}
>>
>>any clue welcome,
>>Daan
>
Re: weird test failure
Posted by Chiradeep Vittal <Ch...@citrix.com>.
Some insight here
http://www.javatuning.com/why-is-thread-sleep-inherently-inaccurate/
On 8/6/13 8:16 AM, "Daan Hoogland" <da...@gmail.com> wrote:
>H,
>
>I just had a time skew that seems impossible:
>
>if in the folowing test the sleep is 1000 it reports a failure saying
>the duration was 999. now I see at least some clock ticks around it so
>whats heppening? An overeager optimizer, maybe? I had to set it to
>1001 to make it work. This is not new code, it has been there since
>jan 24! So i ran it a few times.
>
>public class TestProfiler extends Log4jEnabledTestCase {
> protected final static Logger s_logger =
>Logger.getLogger(TestProfiler.class);
>
> @Test
> public void testProfiler() {
> s_logger.info("testProfiler() started");
>
> Profiler pf = new Profiler();
> pf.start();
> try {
> Thread.sleep(1001);
> } catch (InterruptedException e) {
> }
> pf.stop();
>
> s_logger.info("Duration : " + pf.getDuration());
>
> Assert.assertTrue(pf.getDuration() >= 1000);
>
> s_logger.info("testProfiler() stopped");
> }
>}
>
>any clue welcome,
>Daan