iot-lab / iot-lab-mqtt

Provide access to IoT-LAB experiments as MQTT agents
Other
2 stars 8 forks source link

Issue with iotlab-mqtt-clients serial #8

Closed rfuentess closed 7 years ago

rfuentess commented 7 years ago

This is a bug, but in certain way expected to happen. And, probably putting a warning in the documentation should be enough.

The conditions for triggering are:

  1. Experiment is already running
  2. Server side is already running the MQTT serial counterpart
  3. Client side is already runningiotlab-mqtt-clients serial and the command linestart was already introduced.
  4. User uses the node-cli command for manually updating the firmware.

This provokes a callback error on the client side. And sometimes, the python instance is frozen, forcing to close the terminal or sending the process to the background.

This is the error generated:

(Cmd) Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/rfuentess/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 2580, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/home/rfuentess/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 1378, in loop_forever
    rc = self.loop(timeout, max_packets)
  File "/home/rfuentess/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 897, in loop
    rc = self.loop_read(max_packets)
  File "/home/rfuentess/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 1177, in loop_read
    rc = self._packet_read()
  File "/home/rfuentess/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 1766, in _packet_read
    rc = self._packet_handle()
  File "/home/rfuentess/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 2239, in _packet_handle
    return self._handle_publish()
  File "/home/rfuentess/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 2414, in _handle_publish
    self._handle_on_message(message)
  File "/home/rfuentess/.local/lib/python2.7/site-packages/paho/mqtt/client.py", line 2568, in _handle_on_message
    t[1](self, self._userdata, message)
  File "/home/rfuentess/.local/lib/python2.7/site-packages/iotlabmqtt/mqttcommon.py", line 206, in _wrapper
    return callback(msg, **fields)
  File "/home/rfuentess/.local/lib/python2.7/site-packages/iotlabmqtt/clients/common.py", line 104, in _wrapped
    ret = func(*args, **kwargs)
  File "/home/rfuentess/.local/lib/python2.7/site-packages/iotlabmqtt/clients/serial.py", line 91, in line_handler
    line = message.payload.decode('utf-8')
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 2: invalid start byte
cladmi commented 7 years ago

Hi Raul, you should upgrade your client version as it is fixed by in 0.6.0:

https://github.com/iot-lab/iot-lab-mqtt/blob/master/iotlabmqtt/clients/serial.py#L92 https://github.com/iot-lab/iot-lab-mqtt/commit/a556b626dd7225198f4035018af5babf95a7b34c