#1184 concurrent::ActorTest.testStop has unstable behaviour

vkuzkokov Sat 28 Aug 2010

Running test mentioned above on not the oldest PC in the world (namely Core2 1.8GHz with Ubuntu 10.04 upon it) may result in both:

-- Run:  concurrent::ActorTest.testStop...
   Pass: concurrent::ActorTest.testStop [331]

and:

-- Run:  concurrent::ActorTest.testStop...

TEST FAILED
sys::TestErr: Test failed
  fan.sys.Test.err (Test.java:179)
  fan.sys.Test.fail (Test.java:173)
  fan.sys.Test.verify (Test.java:57)
  fan.sys.Test.verify (Test.java:54)
  concurrent::ActorTest.testStop (ActorTest.fan:225)
  java.lang.reflect.Method.invoke (Method.java:597)
  fan.sys.Method.invoke (Method.java:536)
  fan.sys.Method$MethodFunc.callList (Method.java:188)
  fan.sys.Method.callList (Method.java:147)
  fanx.tools.Fant.runTest (Fant.java:174)
  fanx.tools.Fant.test (Fant.java:94)
  fanx.tools.Fant.test (Fant.java:30)
  fanx.tools.Fant.run (Fant.java:259)
  fanx.tools.Fant.main (Fant.java:295)

The latter happens in about 10% cases. It happens in lines:

t1 := Duration.now
verifyErr(TimeoutErr#) { pool.stop.join(100ms) }
t2 := Duration.now
verify(t2 - t1 <= 120ms) // here we fail

It means we want stop to trigger in 20ms. This is slightly above the time quantum in both Windows(1/64 sec) and Linux(10ms by default).

Suggested solutions:

  • Put a note that it's OK for this test to fail sometimes.
  • Increase time limit.
  • Use statistical approach, thus not enforcing hard real-time on environment.

brian Sat 28 Aug 2010

Yeah that test sometimes fails on my MacBook. I was trying to balance keeping the test duration short without a long wait period, but still tight enough to test it still works.

I bumped up the time to 140ms - should provide a bit more wiggle room

changeset

Login or Signup to reply.