arduino_firmata icon indicating copy to clipboard operation
arduino_firmata copied to clipboard

Process never exits

Open phemmer opened this issue 10 years ago • 0 comments

Whenever my process which is using ArduinoFirmata tries to exit gracefully, it never exits because ArduinoFirmata is stuck.

When I do a CTRL+C, the last few lines of the trace are:

/usr/local/firmata-server/vendor/bundle/ruby/1.9.1/gems/arduino_firmata-0.3.7/lib/arduino_firmata/arduino.rb:85:in `sleep': Interrupt
    from /usr/local/firmata-server/vendor/bundle/ruby/1.9.1/gems/arduino_firmata-0.3.7/lib/arduino_firmata/arduino.rb:85:in `block in close'
    from /usr/local/firmata-server/vendor/bundle/ruby/1.9.1/gems/arduino_firmata-0.3.7/lib/arduino_firmata/arduino.rb:81:in `loop'
    from /usr/local/firmata-server/vendor/bundle/ruby/1.9.1/gems/arduino_firmata-0.3.7/lib/arduino_firmata/arduino.rb:81:in `close'
    from /usr/local/firmata-server/vendor/bundle/ruby/1.9.1/gems/arduino_firmata-0.3.7/lib/arduino_firmata/arduino.rb:34:in `block in initialize'

When I add some debugging code to arduino.rb:82, it shows that @serial.closed? == true and @thread_status == true. Looking through the code I would guess that the process_input thread is stuck on line 195 doing a blocking read. So it it never returns from line 41 to see that @status has been change to Status::CLOSE.


I personally don't see why it needs the at_exit do close end. It'll get closed automatically when the process exits. So perhaps the solution would be to remove that.

phemmer avatar Apr 21 '14 05:04 phemmer