aws / aws-iot-device-sdk-embedded-C

SDK for connecting to AWS IoT from a device using embedded C.
MIT License
975 stars 623 forks source link

After continuously reporting shadow data for a period of time, the server connection is reset (0x50), and the device cannot be reconnected #1851

Closed ZL-LF closed 1 year ago

ZL-LF commented 1 year ago

The AWS SDK version used is 3.1.0 db5ef6001ea820a5365b42286c55abe Figure 1 shows that after reporting for a period of time, TLS reports an error (0x50), and then it continues (0x04e), and aws can no longer reconnect b6d6d234bebe99a4359feb9215a766e Figure 2 shows the corresponding ssl error code. It seems that the server has reset the connection? Why does the server reset the connection? Is this a server problem? If you reset the connection, why does the device not automatically reconnect? A callback function has been configured 1676885132364 1676885193615 Figures 3 and 4 are callback functions registered to AWS. You cannot enter the callback function by looking at the log

AniruddhaKanhere commented 1 year ago

Hello @ZL-LF,

I am sorry to hear that you are having this issue.

Can you get a Wireshark trace for us? It will help us figure out what is going wrong and why is the server disconnecting your device by resetting the connection.

Can you set a breakpoint on the disconnectCallbackHandler as well? When you are disconnected, the breakpoint should be triggered and you should be able to step through the code and see why does the code not reconnect automatically.

Let me know if that helps.

Thanks, Aniruddha

ZL-LF commented 1 year ago

1677121334032 After unplugging the network cable, AWS will be disconnected automatically. After plugging in the network cable, AWS will be automatically connected

I don't know why the shadow data cannot be reconnected

ZL-LF commented 1 year ago

你好@ZL-LF,

我很遗憾听到您遇到此问题。

你能为我们找到Wireshark的踪迹吗?它将帮助我们找出出了什么问题以及服务器通过重置连接来断开设备连接的原因。

您也可以在 上设置断点吗?断开连接时,应触发断点,并且您应该能够单步执行代码并查看代码不自动重新连接的原因。disconnectCallbackHandler

让我知道这是否有帮助。

谢谢,阿尼鲁达

After unplugging the network cable for independent test, AWS will be disconnected automatically. After plugging in the network cable, AWS will be automatically connected

I don't know why the shadow data cannot be reconnected

AniruddhaKanhere commented 1 year ago

Hello, thank you for that information.

But, to zero-in on the issue, you will have to step through the code to see what happens when the disconnectCallbackHandler is called. If you device is connected to AWS IoT Core is connected then maybe the callback is not setting up the shadow correctly? Or is might be holding on to old state. We can exactly see what is happening if we step through the code.

Thanks, Aniruddha

zhuang-hy commented 1 year ago

已收到,我会尽快回复!

AniruddhaKanhere commented 1 year ago

Hello @zhuang-hy, any updates?

AniruddhaKanhere commented 1 year ago

Hello @zhuang-hy, I am closing this issue due to the inactivity on this. Feel free to reopen this issue or open a new one if you face any more problems. You can also reach out to our comunity of users through freertos forums.