bug
A finite state machine implemented using mruby-fsm with a single state in an infinite loop crashes after a random number of cycles.
how to reproduce
- build mruby using "run_test.rb" provided in the repository;
- run the following test program ("test.rb"):
fsm = FSM::Machine.new(:counter)
fsm.params.counter = 0
loop_state = FSM::State.new("loop")
loop_state.in_loop do
fsm.params.counter += 1
puts "fsm.params.counter += 1 => #{fsm.params.counter}"
end
loop_state.timing = 0.010
fsm.add(loop_state)
fsm.run "loop"
- wait a random number of cycles (187|1006|6630|50826|73511|...) until the program exits with one of the following errors:
trace:
[0] test.rb:12
test.rb:12: cannot set instance variable (ArgumentError)
or
trace:
[0] test.rb:12
test.rb:12: non float value (TypeError)