eclipse / paho.mqtt.java

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

Timed out waiting for a response from the server #785

Open kingflyok opened 4 years ago

kingflyok commented 4 years ago

I use IMqttAsyncClient, which throws an exception in the setCallback function

2020-06-06T07:39:07.217382883Z 2020-06-06 15:39:07.217 ERROR 1 --- [1f-9308a60f67bd] o.e.p.c.mqttv3.internal.ClientState : 7e12cfaf-7734-40d3-ad1f-9308a60f67bd: Timed out as no activity, keepAlive=60,000,000,000 lastOutboundActivity=3,702,800,591,221,505 lastInboundActivity=3,702,740,659,674,271 time=3,702,860,591,244,376 lastPing=3,702,800,591,224,053 2020-06-06T07:39:07.227207116Z 2020-06-06 15:39:07.226 INFO 1 --- [1f-9308a60f67bd] com.kunyue.mqtt.mqtt.OnMessageCallback : 客户端断开:{} 2020-06-06T07:39:07.227239180Z 2020-06-06T07:39:07.227244435Z org.eclipse.paho.client.mqttv3.MqttException: Timed out waiting for a response from the server 2020-06-06T07:39:07.227248742Z at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:31) ~[org.eclipse.paho.client.mqttv3-1.2.2.jar!/:na] 2020-06-06T07:39:07.227253125Z at org.eclipse.paho.client.mqttv3.internal.ClientState.checkForActivity(ClientState.java:741) ~[org.eclipse.paho.client.mqttv3-1.2.2.jar!/:na] 2020-06-06T07:39:07.227257127Z at org.eclipse.paho.client.mqttv3.internal.ClientComms.checkForActivity(ClientComms.java:816) [org.eclipse.paho.client.mqttv3-1.2.2.jar!/:na] 2020-06-06T07:39:07.227269238Z at org.eclipse.paho.client.mqttv3.internal.ClientComms.checkForActivity(ClientComms.java:802) [org.eclipse.paho.client.mqttv3-1.2.2.jar!/:na] 2020-06-06T07:39:07.227272648Z at org.eclipse.paho.client.mqttv3.TimerPingSender$PingTask.run(TimerPingSender.java:79) [org.eclipse.paho.client.mqttv3-1.2.2.jar!/:na] 2020-06-06T07:39:07.227276759Z at java.util.TimerThread.mainLoop(Timer.java:555) [na:1.8.0_212] 2020-06-06T07:39:07.227280924Z at java.util.TimerThread.run(Timer.java:505) [na:1.8.0_212] 2020-06-06T07:39:07.227284558Z

zhangdaopin commented 4 years ago

@kingflyok hello,I have encountered the same problem. Do you have any good suggestions for me? Thank you. . .

Jakecy commented 4 years ago

it happended to me too

thkdog commented 3 years ago

it happens to me too... I used to use node mqtt-client, connected to the same server, actually it never lost connection. But changed to paho, it lost connection many times a day, which forced me to call system.exit(0). I'm using k8s container, which will restart when process exit... I've checked the mqtt-server, it has been online for more than a year, and other ARM devices connected almost never lost, or much more less than paho...

ramyakbhatt commented 3 years ago

This is a burning issue. We are facing this issue in our prod environment, when and why this happens nobody knows. It's a serious critical problem, please anybody from the developer team look into this on priority.

J0s3f commented 3 years ago

I had the exact same problem when many messages where queued at the broker for this client. Changing the client id so that the client won't get the queued messages "fixes" it, but then of course the queued messages are lost!

Switching from Paho to the HiveMQ MQTT Client properly fixed this problem, so there is definitely a bug in Paho causing this problems!

zhangdaopin commented 3 years ago

@kingflyok hello,I have encountered the same problem. Do you have any good suggestions for me? Thank you. . .

When we were doing a 72-hour stability test, we still found that after running smoothly for a period of time (approximately), our clients connected to EMQXbroker(4.2.3) began to disconnect frequently, then reconnected, and then disconnected again. . . . image

liushengbin commented 1 year ago

it happended to me too。

kondubhSICKAG commented 1 year ago

we are experiencing same issue. was there any fix ?