Edge module crash on ssl.SSLCertVerificationError:
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 473
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 7
Description
I have my edge module running in python. The certificates are valid and initially it is able to connect to EdgeAgent and EdgeHub. Everything works well but after some time it crashes with below reason/stack trace
```
{'hub': 'abcd-IoT-Hub.azure-devices.net', 'device_id': '0590000010'}
device client created with iothub hostname
Syncing device twin ...
{'desired': {'$version': 2}, 'reported': {'$version': 1}}
Unexpected error Error in the IoTHub client due to TLS exchanges.
Shutting down IoT Hub Client...
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 390, in connect
rc = self._mqtt_client.connect(
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1073, in reconnect
sock.do_handshake()
File "/usr/local/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 33, in handle_result
return await callback.completion()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/async_adapter.py", line 91, in completion
return await self.future
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/pipeline/pipeline_stages_mqtt.py", line 189, in _run_op
self.transport.connect(password=password)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 403, in connect
raise exceptions.TlsExchangeAuthError() from e
azure.iot.device.common.transport_exceptions.TlsExchangeAuthError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./main.py", line 75, in
asyncio.run(main())
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "./main.py", line 67, in main
await iot_agent.start()
File "/usr/local/lib/python3.8/site-packages/abcd/iot/edge_module.py", line 20, in start
await self.module_client.connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/aio/patch_documentation.py", line 146, in connect
return await super(IoTHubModuleClient, self).connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 231, in connect
await handle_result(callback)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 45, in handle_result
raise exceptions.ClientError("Error in the IoTHub client due to TLS exchanges.") from e
azure.iot.device.exceptions.ClientError: Error in the IoTHub client due to TLS exchanges.
Task was destroyed but it is pending!
task: wait_for=._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, ()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: wait_for=()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
{'hub': 'abcd-IoT-Hub.azure-devices.net', 'device_id': '0590000010'}
device client created with iothub hostname
Syncing device twin ...
{'desired': {'$version': 2}, 'reported': {'$version': 1}}
Unexpected error Error in the IoTHub client due to TLS exchanges.
Shutting down IoT Hub Client...
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 390, in connect
rc = self._mqtt_client.connect(
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1073, in reconnect
sock.do_handshake()
File "/usr/local/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 33, in handle_result
return await callback.completion()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/async_adapter.py", line 91, in completion
return await self.future
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/pipeline/pipeline_stages_mqtt.py", line 189, in _run_op
self.transport.connect(password=password)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 403, in connect
raise exceptions.TlsExchangeAuthError() from e
azure.iot.device.common.transport_exceptions.TlsExchangeAuthError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./main.py", line 75, in
asyncio.run(main())
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "./main.py", line 67, in main
await iot_agent.start()
File "/usr/local/lib/python3.8/site-packages/abcd/iot/edge_module.py", line 20, in start
await self.module_client.connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/aio/patch_documentation.py", line 146, in connect
return await super(IoTHubModuleClient, self).connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 231, in connect
await handle_result(callback)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 45, in handle_result
raise exceptions.ClientError("Error in the IoTHub client due to TLS exchanges.") from e
azure.iot.device.exceptions.ClientError: Error in the IoTHub client due to TLS exchanges.
Task was destroyed but it is pending!
task: wait_for=._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, ()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: wait_for=()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
{'hub': 'abcd-IoT-Hub.azure-devices.net', 'device_id': '0590000010'}
device client created with iothub hostname
Syncing device twin ...
{'desired': {'$version': 2}, 'reported': {'$version': 1}}
Unexpected error Error in the IoTHub client due to TLS exchanges.
Shutting down IoT Hub Client...
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 390, in connect
rc = self._mqtt_client.connect(
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1073, in reconnect
sock.do_handshake()
File "/usr/local/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 33, in handle_result
return await callback.completion()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/async_adapter.py", line 91, in completion
return await self.future
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/pipeline/pipeline_stages_mqtt.py", line 189, in _run_op
self.transport.connect(password=password)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 403, in connect
raise exceptions.TlsExchangeAuthError() from e
azure.iot.device.common.transport_exceptions.TlsExchangeAuthError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./main.py", line 75, in
asyncio.run(main())
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "./main.py", line 67, in main
await iot_agent.start()
File "/usr/local/lib/python3.8/site-packages/abcd/iot/edge_module.py", line 20, in start
await self.module_client.connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/aio/patch_documentation.py", line 146, in connect
return await super(IoTHubModuleClient, self).connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 231, in connect
await handle_result(callback)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 45, in handle_result
raise exceptions.ClientError("Error in the IoTHub client due to TLS exchanges.") from e
azure.iot.device.exceptions.ClientError: Error in the IoTHub client due to TLS exchanges.
Task was destroyed but it is pending!
task: wait_for=._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, ()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: wait_for=()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
{'hub': 'abcd-IoT-Hub.azure-devices.net', 'device_id': '0590000010'}
device client created with iothub hostname
Syncing device twin ...
{'desired': {'$version': 2}, 'reported': {'$version': 1}}
Unexpected error Error in the IoTHub client due to TLS exchanges.
Shutting down IoT Hub Client...
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 390, in connect
rc = self._mqtt_client.connect(
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1073, in reconnect
sock.do_handshake()
File "/usr/local/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 33, in handle_result
return await callback.completion()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/async_adapter.py", line 91, in completion
return await self.future
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/pipeline/pipeline_stages_mqtt.py", line 189, in _run_op
self.transport.connect(password=password)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 403, in connect
raise exceptions.TlsExchangeAuthError() from e
azure.iot.device.common.transport_exceptions.TlsExchangeAuthError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./main.py", line 75, in
asyncio.run(main())
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "./main.py", line 67, in main
await iot_agent.start()
File "/usr/local/lib/python3.8/site-packages/abcd/iot/edge_module.py", line 20, in start
await self.module_client.connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/aio/patch_documentation.py", line 146, in connect
return await super(IoTHubModuleClient, self).connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 231, in connect
await handle_result(callback)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 45, in handle_result
raise exceptions.ClientError("Error in the IoTHub client due to TLS exchanges.") from e
azure.iot.device.exceptions.ClientError: Error in the IoTHub client due to TLS exchanges.
Task was destroyed but it is pending!
task: wait_for=._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, ()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: wait_for=()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
{'hub': 'abcd-IoT-Hub.azure-devices.net', 'device_id': '0590000010'}
device client created with iothub hostname
Syncing device twin ...
{'desired': {'$version': 2}, 'reported': {'$version': 1}}
Unexpected error Error in the IoTHub client due to TLS exchanges.
Shutting down IoT Hub Client...
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 390, in connect
rc = self._mqtt_client.connect(
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1073, in reconnect
sock.do_handshake()
File "/usr/local/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 33, in handle_result
return await callback.completion()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/async_adapter.py", line 91, in completion
return await self.future
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/pipeline/pipeline_stages_mqtt.py", line 189, in _run_op
self.transport.connect(password=password)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 403, in connect
raise exceptions.TlsExchangeAuthError() from e
azure.iot.device.common.transport_exceptions.TlsExchangeAuthError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./main.py", line 75, in
asyncio.run(main())
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "./main.py", line 67, in main
await iot_agent.start()
File "/usr/local/lib/python3.8/site-packages/abcd/iot/edge_module.py", line 20, in start
await self.module_client.connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/aio/patch_documentation.py", line 146, in connect
return await super(IoTHubModuleClient, self).connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 231, in connect
await handle_result(callback)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 45, in handle_result
raise exceptions.ClientError("Error in the IoTHub client due to TLS exchanges.") from e
azure.iot.device.exceptions.ClientError: Error in the IoTHub client due to TLS exchanges.
Task was destroyed but it is pending!
task: wait_for=._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, ()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: wait_for=()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
{'hub': 'abcd-IoT-Hub.azure-devices.net', 'device_id': '0590000010'}
device client created with iothub hostname
Syncing device twin ...
{'desired': {'$version': 2}, 'reported': {'$version': 1}}
Unexpected error Error in the IoTHub client due to TLS exchanges.
Shutting down IoT Hub Client...
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 390, in connect
rc = self._mqtt_client.connect(
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1073, in reconnect
sock.do_handshake()
File "/usr/local/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 33, in handle_result
return await callback.completion()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/async_adapter.py", line 91, in completion
return await self.future
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/pipeline/pipeline_stages_mqtt.py", line 189, in _run_op
self.transport.connect(password=password)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 403, in connect
raise exceptions.TlsExchangeAuthError() from e
azure.iot.device.common.transport_exceptions.TlsExchangeAuthError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./main.py", line 75, in
asyncio.run(main())
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "./main.py", line 67, in main
await iot_agent.start()
File "/usr/local/lib/python3.8/site-packages/abcd/iot/edge_module.py", line 20, in start
await self.module_client.connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/aio/patch_documentation.py", line 146, in connect
return await super(IoTHubModuleClient, self).connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 231, in connect
await handle_result(callback)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 45, in handle_result
raise exceptions.ClientError("Error in the IoTHub client due to TLS exchanges.") from e
azure.iot.device.exceptions.ClientError: Error in the IoTHub client due to TLS exchanges.
Task was destroyed but it is pending!
task: wait_for=._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, ()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: wait_for=()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
{'hub': 'abcd-IoT-Hub.azure-devices.net', 'device_id': '0590000010'}
device client created with iothub hostname
Syncing device twin ...
{'desired': {'$version': 2}, 'reported': {'$version': 1}}
Unexpected error Error in the IoTHub client due to TLS exchanges.
Shutting down IoT Hub Client...
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 390, in connect
rc = self._mqtt_client.connect(
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1073, in reconnect
sock.do_handshake()
File "/usr/local/lib/python3.8/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1131)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 33, in handle_result
return await callback.completion()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/async_adapter.py", line 91, in completion
return await self.future
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/pipeline/pipeline_stages_mqtt.py", line 189, in _run_op
self.transport.connect(password=password)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/common/mqtt_transport.py", line 403, in connect
raise exceptions.TlsExchangeAuthError() from e
azure.iot.device.common.transport_exceptions.TlsExchangeAuthError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./main.py", line 75, in
asyncio.run(main())
File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "./main.py", line 67, in main
await iot_agent.start()
File "/usr/local/lib/python3.8/site-packages/abcd/iot/edge_module.py", line 20, in start
await self.module_client.connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/aio/patch_documentation.py", line 146, in connect
return await super(IoTHubModuleClient, self).connect()
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 231, in connect
await handle_result(callback)
File "/usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_clients.py", line 45, in handle_result
raise exceptions.ClientError("Error in the IoTHub client due to TLS exchanges.") from e
azure.iot.device.exceptions.ClientError: Error in the IoTHub client due to TLS exchanges.
Task was destroyed but it is pending!
task: wait_for=._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, ()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: wait_for=()]> cb=[_chain_future.._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
```
The certificates are valid till 2030. When I delete the EdgeAgent and EdgeHub module everyting starts working but after some time the issues pops up again.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.