Skip to content

bug: single-state machine in infinite loop crashes after a while #1

@ghost

Description

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

  1. build mruby using "run_test.rb" provided in the repository;
  2. 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"
  1. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions