Giter Site home page Giter Site logo

Comments (3)

domasgim avatar domasgim commented on June 5, 2024

@bennydiamond we have encountered a similar situation in our solution using MQTT protocol as well, here's our solution to adjust queues message timeout, you can adjust these values according to your needs but with this patch the queued messages will be flushed after 10 seconds with one resend retry after 5 seconds:

This lowers timeout and retry values since we do not want
messages to be kept in internal SDK message queue for too long

There is OPTION_MESSAGE_TIMEOUT that may be used in the SDK
but it is deprecated

--- a/iothub_client/src/iothubtransport_mqtt_common.c
+++ b/iothub_client/src/iothubtransport_mqtt_common.c
@@ -46,8 +46,8 @@
 #define DEFAULT_CONNACK_TIMEOUT             30 // 30 seconds
 #define BUILD_CONFIG_USERNAME               24
 #define SAS_TOKEN_DEFAULT_LEN               10
-#define RESEND_TIMEOUT_VALUE_MIN            1*60
-#define TELEMETRY_MSG_TIMEOUT_MIN           2*60
+#define RESEND_TIMEOUT_VALUE_MIN            5
+#define TELEMETRY_MSG_TIMEOUT_MIN           10
 #define DEFAULT_CONNECTION_INTERVAL         30
 #define FAILED_CONN_BACKOFF_VALUE           5
 #define STATUS_CODE_FAILURE_VALUE           500

Or instead of a patch the two values right here https://github.com/Azure/azure-iot-sdk-c/blob/main/iothub_client/src/iothubtransport_mqtt_common.c#L50-L49

Do note that this may be considered a workaround for such problem but it suited our needs

from azure-iot-sdk-c.

ericwol-msft avatar ericwol-msft commented on June 5, 2024

connection and messaging reliability is documented here

We might have come into a situation where some devices have spotty communication with the cloud and outgoing messages (Device to cloud) are getting stuck and accumulated in doubly linked lists to the point the device runs out of memory

This SDK does not implement a max queue size as that is best determined by the application and platform requirements. You would need to implement an application dependent queue to be handle your application needs for messaging and monitor the sending of the messages and their corresponding status callbacks.

Normal operation of the SDK will temporarily hold on to the message and try to reconnect to the hub if disconnected due to infrastructure issue.

Connection Retry Policies can be set to application specific needs.

from azure-iot-sdk-c.

ewertons avatar ewertons commented on June 5, 2024

Closing this issue based on the last comment from @ericwol-msft
Please feel free to reopen it or open a new one if you would like to follow up.
Thanks,
Azure IoT SDK Team

from azure-iot-sdk-c.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.