question

KarimWalidAbdelazimElhammady-6623 avatar image
1 Vote"
KarimWalidAbdelazimElhammady-6623 asked ricardosolisvillegas-4678 commented

Not receiving ACKs when connection to IoT Hub through an edge device

Hello,

I am connecting to the IoT Hub through an edge device. I am sending some telemetry data to the edge. The packets send are processed on the IoT Edge and stored somewhere. The issue that I am currently having is not getting some ACK packets from the server sometimes which causes a connection reset.

Their are 3 different cases:

1) the device is sending telemetary packet and receiving the ACK from the server after each packet
2) The device send few packets without getting any response from the server, and after a while the server send successive ACK packets.
3) Case number 2 trigger a reset. so the device send a TCP RST flag and then attempt to re-connect to the server.

What happens after triggering the RST flag depends on the version of QOS that I am currently using.

When using QOS 1, the device never recovers from this state and keep going in a loop trying to send RST and re-connect, until it eventually stops any further attempts and it gets stuck somewhere in the code.
When using QOS 0, the device recovers normally after sending the RST flag. However, the issue might happen again after some time.

I am attaching screenshots of the wireshark capture for the three different cases that I described.

my question is, what might be the reason that the server is not responding with ACK packets? Also, what makes the board gets stuck when using QOS1?

Thanks,
Karim

![201263-3.jpeg][1]
![201236-1.jpeg][2]
![201237-2.jpeg][3]
[1]: /answers/storage/attachments/201263-3.jpeg
[2]: /answers/storage/attachments/201236-1.jpeg
[3]: /answers/storage/attachments/201237-2.jpeg

azure-iot-hubazure-iot-edgeazure-iot
3.jpeg (66.3 KiB)
1.jpeg (159.1 KiB)
2.jpeg (89.3 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @KarimWalidAbdelazimElhammady-6623

Thank you for your post!

I want to ask few details so, please see some questions below:

Are you using Quality of service for MQTT?

When you are referring to QOS1,2 and 3... Is this for QoS levels in MQTT?

Looking forward to your feedback,

BR,



0 Votes 0 ·

Hello @ricardosolisvillegas-4678,

thanks for your reply. yes I am using QOS for MQTT. That's what I meant when referring to it.


Thanks,
Karim

0 Votes 0 ·
ricardosolisvillegas-4678 avatar image ricardosolisvillegas-4678 KarimWalidAbdelazimElhammady-6623 ·

Hello,

Did you configure the HTTP_PROXY and URL PROXY settings?

BR,

0 Votes 0 ·
Show more comments
ricardosolisvillegas-4678 avatar image
1 Vote"
ricardosolisvillegas-4678 answered ricardosolisvillegas-4678 commented

Hi @KarimWalidAbdelazimElhammady-6623

Please take a look at this:

201299-image.png




Here is the article where you can get mode details about it.

https://docs.microsoft.com/en-us/azure/iot-dps/iot-dps-mqtt-support


BR,

Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


image.png (30.1 KiB)
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Also, I wondering if you configure the MQTT keep-alive and recall that this can be either the same for each device or diferent.

Finally, Another reason for this drops packet is that the SDK version used has a bug.

Let me know if further details are needed!

BR,

1 Vote 1 ·

Can I know what SDK version that has the bug? And which SDK version fixes this issue? I am using Version: 6.1.10 ( commit: fafaebe513129e0899a832b0899fa9e69187ee06) (repository link: https://github.com/azure-rtos/netxduo)

0 Votes 0 ·
ricardosolisvillegas-4678 avatar image ricardosolisvillegas-4678 KarimWalidAbdelazimElhammady-6623 ·

If I am not mistaken that SDK version is on preview....

0 Votes 0 ·
Show more comments

I am not using DPS. so I think this might be irrelevant to my case. I think I need to find the main reason for the packets dropped.

0 Votes 0 ·
ricardosolisvillegas-4678 avatar image ricardosolisvillegas-4678 KarimWalidAbdelazimElhammady-6623 ·

Thanks for your answer.


You can also specify MQTT over Web Sockets in the client protocol parameter.

By default, the device SDKs connect to an IoT Hub with the CleanSession flag set to 0 and use QoS 1 for message exchange with the IoT hub. While it's possible to configure QoS 0 for faster message exchange, you should note that the delivery isn't guaranteed nor acknowledged. For this reason, QoS 0 is often referred as "fire and forget".

When a device is connected to an IoT hub, the device SDKs provide methods that enable the device to exchange messages with an IoT hub.

See the default timers for this:

201601-image.png


0 Votes 0 ·
image.png (66.1 KiB)

Can you please send me the full ink for this screenshot?

0 Votes 0 ·
ricardosolisvillegas-4678 avatar image
1 Vote"
ricardosolisvillegas-4678 answered ricardosolisvillegas-4678 commented

@KarimWalidAbdelazimElhammady-6623

Thanks for your patience on this.

I would like to comment you that is expected as well as per design that QoS2 shall be dropped. The SDK version should be either 5.0 version or later.

If you want to double check my answer please go thought this explanation below:

NetX Duo MQTT Basic Operation
MQTT (Message Queue Telemetry Transport) is based on publisher-subscriber model. A client can publish information to other clients through a broker. A client, if interested in a topic, can subscribe to the topic through the broker. A broker is responsible for delivering published messages to its clients who subscribe to the topic. In this publisher-subscriber model, multiple clients may publish data with the same topic. A client will receive a message it publishes if the client subscribes to the same topic.

Depending on the use case, a client may choose one of the 3 QoS levels when publishing a message:
QoS 0: The message is delivered at most once. Messages sent with QoS 0 may be lost.
QoS 1: The message is delivered at least once. Messages sent with QoS 1 may be delivered more than once.
QoS 2: The message is delivered exactly once. Messages sent with QoS 2 is guaranteed to be delivered, with no duplication.
Note

This implementation of MQTT client does not support QoS level 2 messages.

I am hoping that those details were enough to realize for what you have seen on your packet captures. Now you know what to expect or what should be the normal behavior.

Cheers!

Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

· 13
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@KarimWalidAbdelazimElhammady-6623

Do you have any other concern that I can address it? If not, please let me know as well.

Best Regards,

1 Vote 1 ·

I think I understand the expected behavior, but I still don't know why I am having this issue. (not getting responses from the server)

1 Vote 1 ·
ricardosolisvillegas-4678 avatar image ricardosolisvillegas-4678 KarimWalidAbdelazimElhammady-6623 ·

Hi,

I wonder if I can ask you to disable TCP timestamps and try doing this test again pls.

Once it is done, let me know the end results and I hope this can get solved by doing this.

Looking forward to your feedback,

BR,

0 Votes 0 ·
Show more comments

Excellent answers and opinions!

0 Votes 0 ·

Many thanks!!

0 Votes 0 ·

Excellent answers and opinions!

0 Votes 0 ·

Excellent answers and opinions!

0 Votes 0 ·