I have followed the tutorial test by step. Almost everything works, except that the PythonModule does not send messages to the IoTHub on the cloud. It does, however, respond to Module Twin calls, evidenced by the entry in the log. Please see the log below. Can you please help me identify what I might be doing wrong?
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516]
IoT Hub Client for Python
Starting the IoT Hub Python sample using protocol MQTT...
The sample is now waiting for messages and will indefinitely. Press Ctrl-C to exit.
Error: Time:Sun Nov 4 22:42:55 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:wait_for_connection Line:385 Failure: connect failure 111.
Error: Time:Sun Nov 4 22:42:55 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:769 wait_for_connection failed
Error: Time:Sun Nov 4 22:42:55 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:760 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Sun Nov 4 22:42:55 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1258 Failed opening the underlying I/O.
Error: Time:Sun Nov 4 22:42:55 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:1000 Error: io_open failed
Error: Time:Sun Nov 4 22:42:55 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2122 failure connecting to address raspberrypi.
Error: Time:Sun Nov 4 22:42:56 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:wait_for_connection Line:385 Failure: connect failure 111.
Error: Time:Sun Nov 4 22:42:56 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:769 wait_for_connection failed
Error: Time:Sun Nov 4 22:42:56 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:760 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Sun Nov 4 22:42:56 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1258 Failed opening the underlying I/O.
Error: Time:Sun Nov 4 22:42:56 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:1000 Error: io_open failed
Error: Time:Sun Nov 4 22:42:56 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2122 failure connecting to address raspberrypi.
Error: Time:Sun Nov 4 22:42:58 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:wait_for_connection Line:385 Failure: connect failure 111.
Error: Time:Sun Nov 4 22:42:58 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:769 wait_for_connection failed
Error: Time:Sun Nov 4 22:42:58 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:760 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Sun Nov 4 22:42:58 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1258 Failed opening the underlying I/O.
Error: Time:Sun Nov 4 22:42:58 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:1000 Error: io_open failed
Error: Time:Sun Nov 4 22:42:58 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2122 failure connecting to address raspberrypi.
Error: Time:Sun Nov 4 22:43:02 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:wait_for_connection Line:385 Failure: connect failure 111.
Error: Time:Sun Nov 4 22:43:02 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:769 wait_for_connection failed
Error: Time:Sun Nov 4 22:43:02 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:760 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Sun Nov 4 22:43:02 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1258 Failed opening the underlying I/O.
Error: Time:Sun Nov 4 22:43:02 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:1000 Error: io_open failed
Error: Time:Sun Nov 4 22:43:02 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2122 failure connecting to address raspberrypi.
Error: Time:Sun Nov 4 22:43:10 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:wait_for_connection Line:385 Failure: connect failure 111.
Error: Time:Sun Nov 4 22:43:10 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:769 wait_for_connection failed
Error: Time:Sun Nov 4 22:43:10 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:760 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Sun Nov 4 22:43:10 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1258 Failed opening the underlying I/O.
Error: Time:Sun Nov 4 22:43:10 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:1000 Error: io_open failed
Error: Time:Sun Nov 4 22:43:10 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2122 failure connecting to address raspberrypi.
Twin callback called with:
updateStatus = COMPLETE
payload = {"desired":{"TemperatureThreshold":25,"$version":8},"reported":{"$version":1}}
context = <__main__.HubManager object at 0x76b61110>
Total calls confirmed: 1
Thank you in advance.
Bahar
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Hello @baharw Thanks for bringing this to our attention, will review the issue and get back to you as soon as possible
@baharw can you test the same sample on a different network? Also can you double check that you are not under a proxy? Configure an IoT Edge device to communicate through a proxy server
Thank you!
I'm having the same issue (just like #17280) and I'm not behind a proxy.
Where the error message says:
_failure connecting to address raspberrypi_
Does that suggest that it is trying to use the hostname raspberrypi? Because my device doesn't use that hostname.
Ok, just found a hostname setting in /etc/iotedge/config.yaml which was set to raspberrypi. Changing that for the actual hostname has resolved error messages shown above, but I'm yet to receive any D2C messages.
Edit:
I found that my edgeHub was crashing with OutOfMemory exceptions. I'd previously set OptimizeForPerformance through the portal but it must have got overwritten somewhere along the way, so I added it to my deployment.template.json in systemModules.edgeHub.env like this:
"OptimizeForPerformance": {
"value": "false"
}
(See https://docs.microsoft.com/en-us/azure/iot-edge/troubleshoot#stability-issues-on-resource-constrained-devices)
Redeployed and it works! I'm now seeing the D2C messages in VS Code :-)
I am seeing the same issue from yesterday. The module was working fine before. Is the "OptimizeForPerformance" option the solution?
IoT Hub Client for Python
35
Error: Time:Mon Nov 12 04:55:32 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:wait_for_connection Line:383 Failure: connect failure 111.
Error: Time:Mon Nov 12 04:55:32 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:767 wait_for_connection failed
Error: Time:Mon Nov 12 04:55:32 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:748 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Mon Nov 12 04:55:32 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1246 Failed opening the underlying I/O.
Error: Time:Mon Nov 12 04:55:32 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:989 Error: io_open failed
Error: Time:Mon Nov 12 04:55:32 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2036 failure connecting to address hydroengnuc1.
Error: Time:Mon Nov 12 04:55:33 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:lookup_address_and_initiate_socket_connection Line:282 Failure: getaddrinfo failure -3.
Error: Time:Mon Nov 12 04:55:33 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:763 lookup_address_and_connect_socket failed
Error: Time:Mon Nov 12 04:55:33 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:748 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Mon Nov 12 04:55:33 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1246 Failed opening the underlying I/O.
Error: Time:Mon Nov 12 04:55:33 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:989 Error: io_open failed
Error: Time:Mon Nov 12 04:55:33 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2036 failure connecting to address hydroengnuc1.
Error: Time:Mon Nov 12 04:55:35 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:lookup_address_and_initiate_socket_connection Line:282 Failure: getaddrinfo failure -3.
Error: Time:Mon Nov 12 04:55:35 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:763 lookup_address_and_connect_socket failed
Error: Time:Mon Nov 12 04:55:35 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:748 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Mon Nov 12 04:55:35 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1246 Failed opening the underlying I/O.
Error: Time:Mon Nov 12 04:55:35 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:989 Error: io_open failed
Error: Time:Mon Nov 12 04:55:35 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2036 failure connecting to address hydroengnuc1.
Error: Time:Mon Nov 12 04:55:39 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:lookup_address_and_initiate_socket_connection Line:282 Failure: getaddrinfo failure -3.
Error: Time:Mon Nov 12 04:55:39 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:763 lookup_address_and_connect_socket failed
Error: Time:Mon Nov 12 04:55:39 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:on_underlying_io_open_complete Line:748 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Mon Nov 12 04:55:39 2018 File:/usr/sdk/src/c/c-utility/adapters/tlsio_openssl.c Func:tlsio_openssl_open Line:1246 Failed opening the underlying I/O.
Error: Time:Mon Nov 12 04:55:39 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:989 Error: io_open failed
Error: Time:Mon Nov 12 04:55:39 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:2036 failure connecting to address hydroengnuc1.
@saifuddin123 the initial suggestion to @baharw was to check if you are under a proxy. Since your error messages are the same can you check that?
Thanks!
@danielcrisp what hostname are you referring to when you say the below...
"Changing that for the actual hostname has resolved error messages shown above, but I'm yet to receive any D2C messages."
Thank you!
@baharw the hostname of the Raspberry Pi itself. It is set here /etc/hostname and /etc/hosts
For example my R-Pi's hostname was set to rpi-f0ff7252 (using the Pi's serial number) but the /etc/iotedge/config.yaml file was using raspberrypi (the default) so the script wasn't working. Changing the config so it matched the real hostname (rpi-f0ff7252) resolved the issue for me.
@saifuddin123 the initial suggestion to @baharw was to check if you are under a proxy. Since your error messages are the same can you check that?
Thanks!
I am not behind a proxy server.
@baharw the hostname of the Raspberry Pi itself. It is set here
/etc/hostnameand/etc/hostsFor example my R-Pi's hostname was set to
rpi-f0ff7252(using the Pi's serial number) but the/etc/iotedge/config.yamlfile was usingraspberrypi(the default) so the script wasn't working. Changing the config so it matched the real hostname (rpi-f0ff7252) resolved the issue for me.
Humm... I checked, and my hostname is raspberrypi. Not sure what is going on,...
I am not behind proxy.
@baharw can you test the same sample on a different network? Also can you double check that you are not under a proxy? Configure an IoT Edge device to communicate through a proxy server
Thank you!
@sergaz-msft I am not behind a proxy. Any other suggestions or updates?
Bringing @shizn under the discussion to share if there are any known issues\bugs related with this one ? Thanks.
@baharw , @saifuddin123 , @danielcrisp see the following MSDN Thread and take a look at stevebus answer since it may be somehow related with this issue.
Thanks
@LazarusX
@baharw Can you run getent hosts raspberry on you Raspberry Pi? Does the result match 127.0.0.1 or the Pi's IP?
The Pi's IP address.
On Thu, Nov 22, 2018 at 12:55 AM Ray Fang notifications@github.com wrote:
@baharw https://github.com/baharw Can you run getend hosts raspberry on
you Raspberry Pi? Does the result match 127.0.0.1 or the Pi's IP?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/MicrosoftDocs/azure-docs/issues/18195#issuecomment-440931009,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AE8SHT9tarLvbH1IVMO6-lndUDvUbxuXks5uxkptgaJpZM4YNjuG
.
Can you add an entry 127.0.0.1 raspberrypi to Pi's /etc/hosts and try again?
Can you add an entry
127.0.0.1 raspberrypito Pi's/etc/hostsand try again?
What will this help do?
After adding this entry, your Raspberry Pi's hostname (raspberry) will be resolved to 127.0.0.1, which may help resolve your issue.
Hello @baharw did the suggestion from @LazarusX helped solve the issue reported?
Thanks!
Hello @baharw did the suggestion from @LazarusX helped solve the issue reported?
Thanks!
Yes, thank you.
We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.