KStateMachine / kstatemachine

KStateMachine is a powerful Kotlin Multiplatform library with clean DSL syntax for creating complex state machines and statecharts driven by Kotlin Coroutines.
https://kstatemachine.github.io/kstatemachine/
Boost Software License 1.0
358 stars 21 forks source link

Event queue is not empty, internal error #96

Closed oyanyev closed 5 months ago

oyanyev commented 5 months ago

Sometimes I get an error: java.lang.IllegalStateException: Event queue is not empty, internal error which invalidates state machine. I tried to research, but it did not become clearer to me

Questions:

  1. What is the exact reason of that?
  2. How to avoid it?
  3. Is that really necessary to throw?
nsk90 commented 5 months ago

Hi! Are you sure that you are working with StateMachine frome single thread?

Do you use coroutines or stdLib version?

Check this issue, there was the same exception. https://github.com/KStateMachine/kstatemachine/issues/87

oyanyev commented 5 months ago

coroutines version.

Thanx. I got the idea. Will dig further.

oyanyev commented 5 months ago

Issue hopefully is gone

nsk90 commented 5 months ago

was it related to multithreading usage? I can mention it in an exception message.

oyanyev commented 5 months ago

Since I used single thread dispatcher, i have not seen it. If It appear again, I definitely notify you