I've got a scheduler test that seems to reproduce what I'm seeing in my 
application. On my Macbook I was unable to place the test inside 
LightArrayRevolverSchedulerSpec because the total test time went over 60s 
and triggered all sorts of alarms and what not. So I just created a new 
spec class and copied the bits I need from LARSSpec. The file is here 
<https://gist.github.com/ecartner/13fb020d25e67e196eb6d7d62a58f6bb>.

"correctly wrap around ticks" in {
  val numEvents = 16
  
  // val targetTicks = Int.MaxValue - numEvents - 2   // Passes
  val targetTicks = Int.MaxValue - numEvents - 1    // Fails

  val cfg = ConfigFactory.parseString("akka.scheduler.tick-duration=2ms")
  withScheduler(config = cfg) { (sched, driver) ⇒
    implicit def ec = localEC
    import driver._

    val start = step / 2

    wakeUp(step * targetTicks)
    probe.expectMsgType[Long](50 seconds)

    val nums = 0 until numEvents
    nums foreach (i ⇒ sched.scheduleOnce(start + step * i, testActor, 
"hello"))
    expectNoMsg(step)
    wakeUp(step)
    expectWait(step)
    nums foreach { _ ⇒
      wakeUp(step)
      expectMsg("hello")
      expectWait(step)
    }
  }
}



It follows the same pattern as "correctly wrap around wheel rounds" and 
"correctly execute jobs when clock wraps around". The key difference being 
it makes a long call to *wakeUp* to get the "time" close to the point of 
interest. As noted in the comment the test can pass or fail based on the 
value of *targetTicks*.

 




On Thursday, April 28, 2016 at 8:23:48 AM UTC-5, Patrik Nordwall wrote:
>
> It would be great if you can create a reproducer in the SchedulerSpec: 
> https://github.com/akka/akka/blob/master/akka-actor-tests/src/test/scala/akka/actor/SchedulerSpec.scala
>
> I think it has a way to drive the clock: 
> https://github.com/akka/akka/blob/master/akka-actor-tests/src/test/scala/akka/actor/SchedulerSpec.scala#L525
>
> /Patrik
>
> On Thu, Apr 28, 2016 at 2:23 PM, Eric Cartner <eric.c...@gmail.com 
> <javascript:>> wrote:
>
>> What information can I provide to help out?
>>
>> On Thursday, April 28, 2016 at 5:11:39 AM UTC-5, Konrad Malawski wrote:
>>>
>>> Yes, the reported issue is might be real and I'd like to get more info 
>>> on it to investigate, I was arguing against the suggestion made to increase 
>>> the range of the scheduler.
>>>
>>> -- 
>>> Konrad `ktoso` Malawski
>>> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>>>
>>> On 28 April 2016 at 12:10:03, Patrik Nordwall (patrik....@gmail.com) 
>>> wrote:
>>>
>>> If I have not misunderstood the reported issue this is not about 
>>> scheduling something 50 days into the future, but after 50 days the 
>>> scheduler stops working. Scheduled tasks were typically around 8 ms.
>>>
>>> On Thu, Apr 28, 2016 at 12:07 PM, Konrad Malawski <
>>> konrad....@lightbend.com> wrote:
>>>
>>>> Is 50 days long enough? I think there is no right or wrong answer to 
>>>> that,
>>>> a quick solution maybe will be to change from Integer to Long which 
>>>> will be an easy fix with a minimal effort, that should extend it to like 
>>>> 500 days or more?
>>>>
>>>> No, because for long term scheduling you want to make sure the thing 
>>>> gets executed – i.e. you need persistence of the events, and also handling 
>>>> things like "it should have triggered in the past, but a node died, before 
>>>> doing it, so we need to run it now".
>>>>
>>>> These are design goals completely different from the Akka scheduler 
>>>> which is geared towards lots and lots of short and very quickly 
>>>> added/removed timeouts – think about all the ask timeouts in the system, 
>>>> there's tens of thousands of those and they last a few seconds.
>>>>
>>>>
>>>> So there seems to be something wrong indeed, let's investigate, however 
>>>> it is not a goal to make the scheduler handle very large intervals – 50 
>>>> days is too much already one might argue actually, but we don't restrain 
>>>> more because why would we :)
>>>>
>>>> -- Konrad
>>>> --
>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>> >>>>>>>>>> Check the FAQ: 
>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>> >>>>>>>>>> Search the archives: 
>>>> https://groups.google.com/group/akka-user
>>>> ---
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Akka User List" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to akka-user+...@googlegroups.com.
>>>> To post to this group, send email to akka...@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/akka-user.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> Patrik Nordwall
>>> Akka Tech Lead
>>> Lightbend <http://www.lightbend.com/> -  Reactive apps on the JVM
>>> Twitter: @patriknw
>>> --
>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>> >>>>>>>>>> Check the FAQ: 
>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>> >>>>>>>>>> Search the archives: 
>>> https://groups.google.com/group/akka-user
>>> ---
>>> You received this message because you are subscribed to the Google 
>>> Groups "Akka User List" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to akka-user+...@googlegroups.com.
>>> To post to this group, send email to akka...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>
>
> -- 
>
> Patrik Nordwall
> Akka Tech Lead
> Lightbend <http://www.lightbend.com/> -  Reactive apps on the JVM
> Twitter: @patriknw
>
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to