Skip to content

starting timer during prestart seems to sometimes cause an "ActorInitializationException: Exception during creation" #6971

Closed
@brah-mcdude

Description

@brah-mcdude
Cause: [akka://test/user/b#653027469]: Akka.Actor.ActorInitializationException: Exception during creation
 ---> System.InvalidOperationException: Worker in invalid state: 1
   at Akka.Actor.HashedWheelTimerScheduler.Start()
   at Akka.Actor.HashedWheelTimerScheduler.InternalSchedule(TimeSpan delay, TimeSpan interval, IRunnable action, ICancelable cancelable)
   at Akka.Actor.HashedWheelTimerScheduler.InternalScheduleTellOnce(TimeSpan delay, ICanTell receiver, Object message, IActorRef sender, ICancelable cancelable)
   at Akka.Actor.SchedulerBase.Akka.Actor.ITellScheduler.ScheduleTellOnce(TimeSpan delay, ICanTell receiver, Object message, IActorRef sender, ICancelable cancelable)
   at Akka.Actor.SchedulerExtensions.ScheduleTellOnceCancelable(IScheduler scheduler, TimeSpan delay, ICanTell receiver, Object message, IActorRef sender)
   at Akka.Actor.Scheduler.TimerScheduler.StartTimer(Object key, Object msg, TimeSpan timeout, TimeSpan initialDelay, Boolean repeat)
   at Akka.Actor.Scheduler.TimerScheduler.StartSingleTimer(Object key, Object msg, TimeSpan timeout)

Version Information
Version of Akka.NET?
1.5.13
Which Akka.NET Modules?
Akka.Actor.Scheduler.TimerScheduler
Akka.Actor.HashedWheelTimerScheduler

Describe the bug
I am running my tests. I am using the "Run Until Failure" menu item in the test explorer menu.
The tests always fail. Usually only after a few iterations (at around 70 iterations).

Last test log:
Test run finished: 119 Tests (118 Passed, 1 Failed, 0 Skipped) run in 15.9 min. Finished at iteration 127

To Reproduce
Steps to reproduce the behavior:
In my app, many things happen, but the essence of the bug (i did not write a separate test for this - so take it as an unproved theory):

  1. create actor and start timer in prestart
  2. "Run Until Failure" menu item in the test explorer menu
  3. See error after many iterations

Expected behavior
I expect this exception to NOT happen. And for the tests iterations to continue.

Actual behavior
Test stops after a few iterations.

Environment
running on Windows.
Which version of .NET?
"Welcome to .NET 7.0!
SDK Version: 7.0.403"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions