{"action":"created","issue":{"url":"https://api.github.com/repos/sailoog/openplotter/issues/118","repository_url":"https://api.github.com/repos/sailoog/openplotter","labels_url":"https://api.github.com/repos/sailoog/openplotter/issues/118/labels{/name}","comments_url":"https://api.github.com/repos/sailoog/openplotter/issues/118/comments","events_url":"https://api.github.com/repos/sailoog/openplotter/issues/118/events","html_url":"https://github.com/sailoog/openplotter/issues/118","id":184681115,"number":118,"title":"Crash in mqtt_d after two days","user":{"login":"toqduj","id":5449929,"avatar_url":"https://avatars.githubusercontent.com/u/5449929?v=3","gravatar_id":"","url":"https://api.github.com/users/toqduj","html_url":"https://github.com/toqduj","followers_url":"https://api.github.com/users/toqduj/followers","following_url":"https://api.github.com/users/toqduj/following{/other_user}","gists_url":"https://api.github.com/users/toqduj/gists{/gist_id}","starred_url":"https://api.github.com/users/toqduj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toqduj/subscriptions","organizations_url":"https://api.github.com/users/toqduj/orgs","repos_url":"https://api.github.com/users/toqduj/repos","events_url":"https://api.github.com/users/toqduj/events{/privacy}","received_events_url":"https://api.github.com/users/toqduj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-23T09:55:42Z","updated_at":"2016-10-24T17:02:36Z","closed_at":null,"body":"After two days of sending (uninterpreted) MQTT messages to OpenPlotter, I get the following crash in mqtt_d.py. After restarting openplotter, message reception is resumed. I'm not sending unicode from the GPS sensor, so there must be a false byte generated somewhere. \r\n\r\nI'm not sure if incoming signalk messages should be allowed to contain unicode or not. For future language compatibility it would be very nice, but we'd overlook false byte generation such as this case, and run into issues when this value is passed further down the line.\r\n\r\nI can't immediately tell if the non-ascii character is in the MQTT message (around the value), or in the complete SK message (somewhere around the timestamp), but it's probably a good idea to either/and: 1) sanitise the input (verify that the incoming message can be cast into ascii or unicode) or 2) encapsulate the message interpreter in a try/except block, so that faulty incoming messages don't cause OP to stop functioning. \r\n\r\nAnyway, the error is:\r\n-->\r\nTraceback (most recent call last):\r\n  File \"/home/pi/.config/openplotter/mqtt_d.py\", line 97, in <module>\r\n    client_local.loop_forever()\r\n  File \"/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py\", line 1261, in loop_forever\r\n    rc = self.loop(timeout, max_packets)\r\n  File \"/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py\", line 811, in loop\r\n    rc = self.loop_read(max_packets)\r\n  File \"/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py\", line 1073, in loop_read\r\n    rc = self._packet_read()\r\n  File \"/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py\", line 1475, in _packet_read\r\n    rc = self._packet_handle()\r\n  File \"/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py\", line 1943, in _packet_handle\r\n    return self._handle_publish()\r\n  File \"/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py\", line 2118, in _handle_publish\r\n    self._handle_on_message(message)\r\n  File \"/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py\", line 2274, in _handle_on_message\r\n    self.on_message(self, self._userdata, message)\r\n  File \"/home/pi/.config/openplotter/mqtt_d.py\", line 29, in on_message\r\n    SignalK='{\"context\": \"vessels.'+uuid+'\",\"updates\":[{\"source\":{\"type\": \"notifications\",\"src\":\"mqtt\"},\"timestamp\":\"'+timestamp+'\",\"values\":[{\"path\":\"'+path+'\",\"value\":'+value+'}]}]}\\n'\r\nUnicodeDecodeError: 'ascii' codec can't decode byte 0xde in position 124: ordinal not in range(128)\r\n<--\r\n\r\nCheers, \r\n\r\n\r\nB."},"comment":{"url":"https://api.github.com/repos/sailoog/openplotter/issues/comments/255800845","html_url":"https://github.com/sailoog/openplotter/issues/118#issuecomment-255800845","issue_url":"https://api.github.com/repos/sailoog/openplotter/issues/118","id":255800845,"user":{"login":"sailoog","id":8145560,"avatar_url":"https://avatars.githubusercontent.com/u/8145560?v=3","gravatar_id":"","url":"https://api.github.com/users/sailoog","html_url":"https://github.com/sailoog","followers_url":"https://api.github.com/users/sailoog/followers","following_url":"https://api.github.com/users/sailoog/following{/other_user}","gists_url":"https://api.github.com/users/sailoog/gists{/gist_id}","starred_url":"https://api.github.com/users/sailoog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sailoog/subscriptions","organizations_url":"https://api.github.com/users/sailoog/orgs","repos_url":"https://api.github.com/users/sailoog/repos","events_url":"https://api.github.com/users/sailoog/events{/privacy}","received_events_url":"https://api.github.com/users/sailoog/received_events","type":"User","site_admin":false},"created_at":"2016-10-24T17:02:36Z","updated_at":"2016-10-24T17:02:36Z","body":"Ok, thanks for reporting."}}
{"actor":{"display_login":"sailoog"}}