我正在尝试在arm32v7 Raspberry Pi-3模型上实现python模块(例如my-module
)。该模块基于resin / rpi-raspbian:stretch(azure-iothub-device-client == 1.4.0b0)。我有iothub_client
python库,然后在模块内正常工作。
但是,当我尝试在Pi中部署并执行iotedgectl start
时,在docker logs -f <my-module>
中出现以下错误:
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516]
IoT Hub Client for Python
Adding TrustedCerts from: /mnt/edgemodule/edge-device-ca.cert.pem
set_option TrustedCerts successful
Converted audio file 2643035.wav in 5.67014288902 seconds
Payload: {"translatedutctime": "2018-06-23T14:56:59.972036", "filename": "2643035.wav"}
Sending Payload for 2643035.wav ...
Error: Time:Sat Jun 23 14:56:59 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:701 Failure: connect failure 111.
Error: Time:Sat Jun 23 14:56:59 2018 File:/usr/sdk/src/c/c-utility/src/tlsio_openssl.c Func:on_underlying_io_open_complete Line:751 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Sat Jun 23 14:56:59 2018 File:/usr/sdk/src/c/c-utility/src/tlsio_openssl.c Func:tlsio_openssl_open Line:1251 Failed opening the underlying I/O.
Error: Time:Sat Jun 23 14:56:59 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:980 Error: io_open failed
Error: Time:Sat Jun 23 14:56:59 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:1932 failure connecting to address elderberrypi.
Error: Time:Sat Jun 23 14:57:00 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:701 Failure: connect failure 111.
Error: Time:Sat Jun 23 14:57:00 2018 File:/usr/sdk/src/c/c-utility/src/tlsio_openssl.c Func:on_underlying_io_open_complete Line:751 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Sat Jun 23 14:57:00 2018 File:/usr/sdk/src/c/c-utility/src/tlsio_openssl.c Func:tlsio_openssl_open Line:1251 Failed opening the underlying I/O.
Error: Time:Sat Jun 23 14:57:00 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:980 Error: io_open failed
Error: Time:Sat Jun 23 14:57:00 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:1932 failure connecting to address elderberrypi.
Error: Time:Sat Jun 23 14:57:02 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:701 Failure: connect failure 111.
Error: Time:Sat Jun 23 14:57:02 2018 File:/usr/sdk/src/c/c-utility/src/tlsio_openssl.c Func:on_underlying_io_open_complete Line:751 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Sat Jun 23 14:57:02 2018 File:/usr/sdk/src/c/c-utility/src/tlsio_openssl.c Func:tlsio_openssl_open Line:1251 Failed opening the underlying I/O.
Error: Time:Sat Jun 23 14:57:02 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:980 Error: io_open failed
Error: Time:Sat Jun 23 14:57:02 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:1932 failure connecting to address elderberrypi.
Converted audio file 4417734.wav in 4.16613197327 seconds
Payload: {"translatedutctime": "2018-06-23T14:57:04.059473", "filename": "4417734.wav"}
Sending Payload for 4417734.wav ...
Error: Time:Sat Jun 23 14:57:06 2018 File:/usr/sdk/src/c/c-utility/adapters/socketio_berkeley.c Func:socketio_open Line:701 Failure: connect failure 111.
Error: Time:Sat Jun 23 14:57:06 2018 File:/usr/sdk/src/c/c-utility/src/tlsio_openssl.c Func:on_underlying_io_open_complete Line:751 Invalid tlsio_state. Expected state is TLSIO_STATE_OPENING_UNDERLYING_IO.
Error: Time:Sat Jun 23 14:57:06 2018 File:/usr/sdk/src/c/c-utility/src/tlsio_openssl.c Func:tlsio_openssl_open Line:1251 Failed opening the underlying I/O.
Error: Time:Sat Jun 23 14:57:06 2018 File:/usr/sdk/src/c/umqtt/src/mqtt_client.c Func:mqtt_client_connect Line:980 Error: io_open failed
Error: Time:Sat Jun 23 14:57:06 2018 File:/usr/sdk/src/c/iothub_client/src/iothubtransport_mqtt_common.c Func:SendMqttConnectMsg Line:1932 failure connecting to address elderberrypi.
Converted audio file 4486452.wav in 4.94396114349 seconds
Payload: {"translatedutctime": "2018-06-23T15:32:28.491401", "filename": "4486452.wav"}
Sending Payload for 4486452.wav ...
Confirmation[0] received for message with result = MESSAGE_TIMEOUT
Properties: {}
Total calls confirmed: 1
现在,这会继续出现几条消息,并且仅在开始之后(永远不会在两者之间,一旦它稳定下来)就会继续。在多次出现此类消息超时和错误之后,该场景将恢复正常,并进行回调确认,而且我也能够在IoTHub中接收消息。结果,我总是会错过前5-10条消息,并且无法在IotHub中看到这些消息。
在排除了很多麻烦之后,我发现问题一直存在。 edgeHub
模块似乎总是在my-module
已经开始发送消息几秒钟后完全初始化。由于edgeHub
尚未完全初始化,并且未设置TLS身份验证和MQTT路径,因此my-module
的前几条消息会丢失。也许是因为树莓派速度很慢?
在my-module
完全初始化之后,我尝试手动启动edgeHub
,在这种情况下,所有消息都没有问题地发送。
问题:是否可以等待edgeHub
完全初始化然后开始发送消息?更重要的是,这是实际问题还是其他原因?
请让我知道是否需要更多信息来获取问题背景。我试图使查询简洁:)
答案 0 :(得分:0)
您指出的是当前行为的准确描述!从当前的实现开始,所有模块都同时启动。其中一些的初始化速度比edgeHub快,这导致了您所看到的行为。这是一个已知问题,我们正在实施修复程序!