iotile / coretools

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

Client authentication occasionally causes exception in thread #975

Closed anwu closed 4 years ago

anwu commented 4 years ago

There are occasional exceptions thrown in threads when trying to connect/authenticate to a device.

Exception in thread Thread-4:
Traceback (most recent call last):
  File "C:\Users\AndrewWu\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "c:\arch\coretools\transport_plugins\bled112\iotile_transport_bled112\bled112_cmd.py", line 49, in run
    res = getattr(self, cmd)(*args)
  File "c:\arch\coretools\transport_plugins\bled112\iotile_transport_bled112\bled112_cmd.py", line 272, in _authenticate_async
    success, data = manager.authenticate(device_uuid, supported_auth, self, conn_handle, services)
  File "c:\arch\coretools\transport_plugins\bled112\iotile_transport_bled112\bled112_auth.py", line 166, in authenticate
    self._send_client_verify(self._session_key, auth_type, command_processor, *command_processor_args)
  File "c:\arch\coretools\transport_plugins\bled112\iotile_transport_bled112\bled112_auth.py", line 74, in _send_client_verify
    err, granted_permissions, server_verify = struct.unpack("BBxx16s", server_verify)
TypeError: a bytes-like object is required, not 'NoneType'

and

Exception in thread Thread-6:
Traceback (most recent call last):
  File "C:\Users\AndrewWu\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "c:\arch\coretools\transport_plugins\bled112\iotile_transport_bled112\bled112_cmd.py", line 49, in run
    res = getattr(self, cmd)(*args)
  File "c:\arch\coretools\transport_plugins\bled112\iotile_transport_bled112\bled112_cmd.py", line 272, in _authenticate_async
    success, data = manager.authenticate(device_uuid, supported_auth, self, conn_handle, services)
  File "c:\arch\coretools\transport_plugins\bled112\iotile_transport_bled112\bled112_auth.py", line 151, in authenticate
    struct.unpack("HBB16s", self._server_hello)
TypeError: a bytes-like object is required, not 'NoneType'

I see these errors quite a bit when I run the pod_controller/acceptance_tests/test_BLE_authentication.py