eclipse / paho.mqtt.java

Eclipse Paho Java MQTT client library. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
2.12k stars 883 forks source link

MQTT thread stuck while plug out the network cable! #925

Open iAmSKU opened 2 years ago

iAmSKU commented 2 years ago

Please fill out the form below before submitting, thank you!

If this is a bug regarding the Android Service, please raise the bug here instead: https://github.com/eclipse/paho.mqtt.android/issues/new

I am using MQTT V3 library to connect to the AWS IOT.

Application is running in the docker environment, The data is send continuously in every second.

I have observed when plugging out the network cable stuck the MQTT thread

In the bellow example

Please refer the bellow sequence of logs:

{"log":"[21-04-2022 12:25:11] [INFO] [MqttOutputAdapterCallback] Delivered message with id 873, with status PUBACK msgId 873\n","stream":"stdout","time":"2022-04-21T12:25:11.258025102Z"}
.---
{"log":"[21-04-2022 12:25:32] [INFO] [MqttSender] Published successfully message with message id 896 to CloudConnector/swt_ied5 with QoS 1\n","stream":"stdout","time":"2022-04-21T12:25:32.201983873Z"}
{"log":"[21-04-2022 12:27:33] [INFO] [MqttSender] Attempting to publish...\n","stream":"stdout","time":"2022-04-21T12:27:33.228734747Z"}
---
---
---
{"log":"[21-04-2022 12:42:24] [WARNING] [MqttOutputAdapterCallback] AWSClient has lost connection, reason is:Timed out while waiting to write messages to the server\n","stream":"stdout","time":"2022-04-21T12:42:24.315486562Z"}
{"log":"[21-04-2022 12:42:25] [INFO] [MqttOutputAdapterCallback] AWSClient reconnected successfully.\n","stream":"stdout","time":"2022-04-21T12:42:25.902589967Z"}

At the same time I have another implementation in paho.mqtt.golang, which connects in the nominal time:

{"log":"2022/04/21 12:12:59 Client is connected to cloud\n","stream":"stderr","time":"2022-04-21T12:12:59.334000262Z"}
{"log":"2022/04/21 12:25:59 Client is disconnected from cloud pingresp not received, disconnecting\n","stream":"stderr","time":"2022-04-21T12:25:59.338688906Z"}
{"log":"2022/04/21 12:26:42 Client  is connected to cloud\n","stream":"stderr","time":"2022-04-21T12:26:42.47533258Z"}

Additional Information: