Development Machine, OS, Compiler (and Other Relevant Toolchain Info)
Build Machine: Mac OS Mojave
Build for: iPhone X - iOS 12
Build Tools: Xcode 10.2
SDK Version (Please Give Commit SHA if Manually Compiling)
PODS:
SPEC CHECKSUMS:
AzureIoTHubClient: 343127ac6edc62af3fe62221243a2ee8e906b5fb
AzureIoTuAmqp: 093aceeea0dc17e38e9fbd785ce2c3a7a7346065
AzureIoTuMqtt: 99005699e0c575d47a2c3878e95769562991f83b
AzureIoTUtility: cf0e15e2342f7c28f9798f3330ccb5d60950fede
Protocol
MQTT
Describe the Bug
Our solution works fine with the default configuration but when we try to disable retry policy we are unable to connect to the IoT Hub and send/receive messages. To disable retry policy we use the following code right after the hub client is created:
(void)IoTHubClient_LL_SetRetryPolicy(_iotHubClientHandle, IOTHUB_CLIENT_RETRY_NONE, 0);
Console Logs
2019-08-19 23:31:18.402 [DEBUG] (9:Thread Pool Worker) [Cloud+IoTHub] : Calling IoT Hub connect from SendAndPurgeIoTHubMessages
2019-08-19 23:31:18.404 [DEBUG] (9:Thread Pool Worker) [Cloud+IoTHub] : Subscribed to IoT hub events
2019-08-19 23:31:18.405 [DEBUG] (9:Thread Pool Worker) [Cloud+IoTHub] : Connecting to IoT Hub [Hostname= ConnectionString= DeviceID= DeviceKey=
2019-08-19 23:31:18.405 [INFO] (9:Thread Pool Worker) [IoTHub] : IoT Hub connection string is null
2019-08-19 23:31:22.638 [DEBUG] (11:Thread Pool Worker) [Cloud+IoTHub] : Connecting to IoT Hub ...
2019-08-19 23:31:22.645 [DEBUG] (11:Thread Pool Worker) [IoTHub] : Connected to IoT Hub
2019-08-19 23:31:22.666 [VERIFY] (11:Thread Pool Worker) [Cloud+IoTHub] : Creating IoT Hub Message: {...}
2019-08-19 23:31:22.671 [DEBUG] (11:Thread Pool Worker) [Cloud+IoTHub] : Pending IoT Hub Messages are => 1
2019-08-19 23:31:22.674 [DEBUG] (11:Thread Pool Worker) [IoTHub] : IoT send message before pause 100201277
2019-08-19 23:31:52.675 [DEBUG] (11:Thread Pool Worker) [IoTHub] : IoT send message after pause 100201277
2019-08-19 23:31:52.675 [VERIFY] (11:Thread Pool Worker) [IoTHub] : App could not connect to Azure
2019-08-19 23:31:52.676 [DEBUG] (11:Thread Pool Worker) [Cloud+IoTHub] : D2C IoT Hub Message response: Error: Not able to send message to IoT Hub
2019-08-19 23:31:52.676 [DEBUG] (11:Thread Pool Worker) [Cloud+IoTHub] : IoT Hub Message Failed to send from /var/mobile/Containers/Data/Application/158F7526-C476-47AE-92AD-C6058E3880EC/Documents/ToSendToIoTHub/20190819_163122.667529 => {...}
2019-08-19 23:31:52.677 [DEBUG] (11:Thread Pool Worker) [Configuration] : [Reachability] Checking reachability status
2019-08-19 23:31:52.855 [INFO] (11:Thread Pool Worker) [Configuration] : [Reachability] Reachability status: ConnectedReachable
2019-08-19 23:31:58.052 [DEBUG] (15:Thread Pool Worker) [Cloud+IoTHub] : Pending IoT Hub Messages are => 1
2019-08-19 23:31:58.052 [DEBUG] (15:Thread Pool Worker) [IoTHub] : IoT send message before pause -405614451
2019-08-19 23:32:28.052 [DEBUG] (15:Thread Pool Worker) [IoTHub] : IoT send message after pause -405614451
2019-08-19 23:32:28.054 [VERIFY] (15:Thread Pool Worker) [IoTHub] : App could not connect to Azure
2019-08-19 23:32:28.055 [DEBUG] (15:Thread Pool Worker) [Cloud+IoTHub] : D2C IoT Hub Message response: Error: Not able to send message to IoT Hub
2019-08-19 23:32:28.056 [DEBUG] (15:Thread Pool Worker) [Cloud+IoTHub] : IoT Hub Message Failed to send from /var/mobile/Containers/Data/Application/158F7526-C476-47AE-92AD-C6058E3880EC/Documents/ToSendToIoTHub/20190819_163122.667529 => {...}
2019-08-19 23:32:35.476 [VERIFY] (15:Thread Pool Worker) [Cloud+IoTHub] : Creating IoT Hub Message: {...}
2019-08-19 23:32:35.484 [DEBUG] (15:Thread Pool Worker) [Cloud+IoTHub] : Pending IoT Hub Messages are => 2
2019-08-19 23:32:35.486 [DEBUG] (15:Thread Pool Worker) [IoTHub] : IoT send message before pause -894935254
2019-08-19 23:33:05.487 [DEBUG] (15:Thread Pool Worker) [IoTHub] : IoT send message after pause -894935254
2019-08-19 23:33:05.488 [VERIFY] (15:Thread Pool Worker) [IoTHub] : App could not connect to Azure
2019-08-19 23:33:05.489 [DEBUG] (15:Thread Pool Worker) [Cloud+IoTHub] : D2C IoT Hub Message response: Error: Not able to send message to IoT Hub
2019-08-19 23:33:05.490 [DEBUG] (15:Thread Pool Worker) [Cloud+IoTHub] : IoT Hub Message Failed to send from /var/mobile/Containers/Data/Application/158F7526-C476-47AE-92AD-C6058E3880EC/Documents/ToSendToIoTHub/20190819_163122.667529 => {...}
2019-08-19 23:33:05.492 [DEBUG] (15:Thread Pool Worker) [IoTHub] : IoT send message before pause -2060922309
2019-08-19 23:33:05.498 [DEBUG] (14:Thread Pool Worker) [Configuration] : [Reachability] Checking reachability status
2019-08-19 23:33:05.664 [INFO] (14:Thread Pool Worker) [Configuration] : [Reachability] Reachability status: ConnectedReachable
2019-08-19 23:33:34.416 [VERIFY] (16:Thread Pool Worker) [Cloud+IoTHub] : Creating IoT Hub Message: {...}
2019-08-19 23:33:35.493 [DEBUG] (15:Thread Pool Worker) [IoTHub] : IoT send message after pause -2060922309
2019-08-19 23:33:35.494 [VERIFY] (15:Thread Pool Worker) [IoTHub] : App could not connect to Azure
2019-08-19 23:33:35.495 [DEBUG] (15:Thread Pool Worker) [Cloud+IoTHub] : D2C IoT Hub Message response: Error: Not able to send message to IoT Hub
2019-08-19 23:33:35.496 [DEBUG] (15:Thread Pool Worker) [Cloud+IoTHub] : IoT Hub Message Failed to send from /var/mobile/Containers/Data/Application/158F7526-C476-47AE-92AD-C6058E3880EC/Documents/ToSendToIoTHub/20190819_163235.477624 => {...}
2019-08-19 23:33:35.497 [DEBUG] (15:Thread Pool Worker) [Configuration] : [Reachability] Checking reachability status
Hey @alexeystrakh thanks for your patience. I was able to repro this on Windows and have submitted a PR which should fix this. Thanks for pointing this out!
https://github.com/Azure/azure-iot-sdk-c/pull/1165
Thanks a lot, @danewalton, glad to hear that you were able to reproduce the issue and have already provided the solution. Looking forward to the updated library so we can incorporate the new version and test it. Awesome work! 馃檹
@alexeystrakh if you would like to test and make sure it works for you feel free to checkout this branch here and rerun whatever samples/code you had before.
PR has been merged
@danewalton, @alexeystrakh, thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey
Most helpful comment
Hey @alexeystrakh thanks for your patience. I was able to repro this on Windows and have submitted a PR which should fix this. Thanks for pointing this out!
https://github.com/Azure/azure-iot-sdk-c/pull/1165