eclipse-paho / eclipse-paho/paho.mqtt.java

MQTT thread stuck while plug out the network cable!

Open
#925 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.3k
Forks
919
PR merge metrics
No merged PRs in 30d

Description

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

- [x] Bug exists Release Version 1.2.5 ( Master Branch)
- [ ] Bug exists in MQTTv3 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
- [ ] Bug exists in MQTTv5 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)

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

- @21-04-2022 12:27:33, last data sending to AWS

- network disconnected (From /var/log/messages)
Apr 21 12:25:11 localhost kernel: igb 0000:02:00.0 enp2s0: igb: enp2s0 NIC Link is Down

- network connected (From /var/log/messages)
Apr 21 12:26:38 localhost kernel: igb 0000:02:00.0 enp2s0: igb: enp2s0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Apr 21 12:26:41 localhost NetworkManager[992]: [1650544001.9459] manager: NetworkManager state is now
CONNECTED_LOCAL

- Application logs lost connection error @21-04-2022 12:42:24 {Approx. 15 minutes delay}
- Connection resume @21-04-2022 12:42:25

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](https://github.com/eclipse/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:

- Using MQTT Aync client for the connectivity.
- setConnectionTimeout is set as 5 second for the MQTT client.
- setKeepAliveInterval is set as 60 second for the MQTT client.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.