iotile / coretools

Core python tools for building and using IOTile based devices
GNU General Public License v3.0
14 stars 7 forks source link

When a device cannot be connected to there's a key error in iotile-gateway #202

Closed timburke closed 7 years ago

timburke commented 7 years ago

Tried to connect to a device that couldn't be found using the awsiot agent:

May 26 22:51:51 localhost gateway.sh[19046]: E-2017-05-26 22:51:51,747-ioloop    :638  Exception in callback <functools.partial object at 0x73b21a50>
May 26 22:51:51 localhost gateway.sh[19046]: Traceback (most recent call last):
May 26 22:51:51 localhost gateway.sh[19046]: File "/config/gateway/venv/local/lib/python2.7/site-packages/tornado/ioloop.py", line 605, in _run_callback
May 26 22:51:51 localhost gateway.sh[19046]: ret = callback()
May 26 22:51:51 localhost gateway.sh[19046]: File "/config/gateway/venv/local/lib/python2.7/site-packages/tornado/stack_context.py", line 277, in null_wrapper
May 26 22:51:51 localhost gateway.sh[19046]: return fn(*args, **kwargs)
May 26 22:51:51 localhost gateway.sh[19046]: File "/config/gateway/venv/local/lib/python2.7/site-packages/tornado/ioloop.py", line 626, in _discard_future_result
May 26 22:51:51 localhost gateway.sh[19046]: future.result()
May 26 22:51:51 localhost gateway.sh[19046]: File "/config/gateway/venv/local/lib/python2.7/site-packages/tornado/concurrent.py", line 238, in result
May 26 22:51:51 localhost gateway.sh[19046]: raise_exc_info(self._exc_info)
May 26 22:51:51 localhost gateway.sh[19046]: File "/config/gateway/venv/local/lib/python2.7/site-packages/tornado/gen.py", line 1069, in run
May 26 22:51:51 localhost gateway.sh[19046]: yielded = self.gen.send(value)
May 26 22:51:51 localhost gateway.sh[19046]: File "/config/gateway/venv/local/lib/python2.7/site-packages/iotile_transport_awsiot/gateway_agent.py", line 574, in _connect_to_device
May 26 22:51:51 localhost gateway.sh[19046]: self._connections[uuid]['report_monitor'] = self._manager.register_monitor(uuid, ['report'], self._notify_report)
May 26 22:51:51 localhost gateway.sh[19046]: KeyError: 210
timburke commented 7 years ago

Also happens over websockets

timburke commented 7 years ago

This bug or a related one can cause a gateway client to hang forever so it seems like there's not a timeout on the websockets cmd stream and the gateway never responds when this exception happens.

inwardvessel commented 7 years ago

Addressed in PR https://github.com/iotile/coretools/pull/208