Skip to content

Edge module crash on ssl.SSLCertVerificationError: #7446

@amit12cool

Description

@amit12cool

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 <module>
    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: <Task pending name='Task-7' coro=<AsyncHandlerManager._receiver_handler_runner() running at /usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_handler_manager.py:43> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, <TaskWakeupMethWrapper object at 0x7fac734340>()]> cb=[_chain_future.<locals>._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: <Task pending name='Task-9' coro=<_AsyncQueueProxy.get() running at /usr/local/lib/python3.8/site-packages/janus/__init__.py:552> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fac726970>()]> cb=[_chain_future.<locals>._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 <module>
    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: <Task pending name='Task-8' coro=<AsyncHandlerManager._receiver_handler_runner() running at /usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_handler_manager.py:43> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, <TaskWakeupMethWrapper object at 0x7f9c346eb0>()]> cb=[_chain_future.<locals>._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: <Task pending name='Task-9' coro=<_AsyncQueueProxy.get() running at /usr/local/lib/python3.8/site-packages/janus/__init__.py:552> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f9c346e50>()]> cb=[_chain_future.<locals>._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 <module>
    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: <Task pending name='Task-8' coro=<AsyncHandlerManager._receiver_handler_runner() running at /usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_handler_manager.py:43> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, <TaskWakeupMethWrapper object at 0x7f9855f760>()]> cb=[_chain_future.<locals>._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: <Task pending name='Task-9' coro=<_AsyncQueueProxy.get() running at /usr/local/lib/python3.8/site-packages/janus/__init__.py:552> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f9855feb0>()]> cb=[_chain_future.<locals>._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 <module>
    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: <Task pending name='Task-8' coro=<AsyncHandlerManager._receiver_handler_runner() running at /usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_handler_manager.py:43> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, <TaskWakeupMethWrapper object at 0x7f9847d370>()]> cb=[_chain_future.<locals>._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: <Task pending name='Task-9' coro=<_AsyncQueueProxy.get() running at /usr/local/lib/python3.8/site-packages/janus/__init__.py:552> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f9847d190>()]> cb=[_chain_future.<locals>._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 <module>
    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: <Task pending name='Task-8' coro=<AsyncHandlerManager._receiver_handler_runner() running at /usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_handler_manager.py:43> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, <TaskWakeupMethWrapper object at 0x7f7c584370>()]> cb=[_chain_future.<locals>._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: <Task pending name='Task-9' coro=<_AsyncQueueProxy.get() running at /usr/local/lib/python3.8/site-packages/janus/__init__.py:552> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f7c584eb0>()]> cb=[_chain_future.<locals>._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 <module>
    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: <Task pending name='Task-8' coro=<AsyncHandlerManager._receiver_handler_runner() running at /usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_handler_manager.py:43> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, <TaskWakeupMethWrapper object at 0x7fa4710340>()]> cb=[_chain_future.<locals>._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: <Task pending name='Task-9' coro=<_AsyncQueueProxy.get() running at /usr/local/lib/python3.8/site-packages/janus/__init__.py:552> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fa4710eb0>()]> cb=[_chain_future.<locals>._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 <module>
    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: <Task pending name='Task-8' coro=<AsyncHandlerManager._receiver_handler_runner() running at /usr/local/lib/python3.8/site-packages/azure/iot/device/iothub/aio/async_handler_manager.py:43> wait_for=<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/local/lib/python3.8/asyncio/futures.py:360, <TaskWakeupMethWrapper object at 0x7fa9553370>()]> cb=[_chain_future.<locals>._call_set_state() at /usr/local/lib/python3.8/asyncio/futures.py:367]>
Task was destroyed but it is pending!
task: <Task pending name='Task-9' coro=<_AsyncQueueProxy.get() running at /usr/local/lib/python3.8/site-packages/janus/__init__.py:552> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fa9553190>()]> cb=[_chain_future.<locals>._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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions