Azure / cookiecutter-azure-iot-edge-module

Creating an Azure IoT Edge Python module project from this Python package project template.
https://docs.microsoft.com/en-us/azure/iot-edge/tutorial-python-module
MIT License
10 stars 10 forks source link

the logs of python module has error information. #31

Closed czgtest closed 5 years ago

czgtest commented 5 years ago

repro on : amd64 /amd64.debug Windows10:

step:

  1. set python version in VSCode settings "azure-iot-edge.version.pythonmodule": "arm64-preview"
  2. create python module
  3. build and run python module in simulator
  4. check the logs of python module it has error in python module,

C:\Users\iotedge>docker logs SampleModulePython IoT Hub Client for Python transport.connect raised error Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/azure/iot/device/common/mqtt_transport.py", line 252, in connect rc = self._mqtt_client.connect(host=self._hostname, port=8883) File "/usr/local/lib/python3.7/site-packages/paho/mqtt/client.py", line 839, in connect return self.reconnect() File "/usr/local/lib/python3.7/site-packages/paho/mqtt/client.py", line 962, in reconnect sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0)) File "/usr/local/lib/python3.7/socket.py", line 727, in create_connection raise err File "/usr/local/lib/python3.7/socket.py", line 716, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

image

The above exception was the direct cause of the following exception:

blackchoey commented 5 years ago

Known issue for Python SDK. This is because EdgeHub is not ready for connect when custom module starts and SDK will throw error in this case. Edge runtime will restart the custom module to retry.