eclipse-paho / eclipse-paho/paho.mqtt.java
Connection lost (32109) java.io.EOFException: AutomaticReconnect causes a loop of reconnections and errors..
- 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.0 ( Master Branch)
- [ ] Bug exists in Snapshot Version 1.2.1-SNAPSHOT (Develop Branch)
- [ ] Bug exists in MQTTv5 Version (mqttv5-new Branch)
Tested on tcp://iot.eclipse.org:1883
AutomaticReconnect enabled
after a successiful connection
the exception is
```
Connessione persa (32109) - java.io.EOFException
org.eclipse.paho.client.mqttv3.MqttException: Connessione persa
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:181)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.EOFException: null
at java.io.DataInputStream.readByte(DataInputStream.java:267)
at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:92)
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:133)
... 7 common frames omitted
```
**RESOLUTION?**
I suppose the error is in the class `MqttInputStream`, method
`public MqttWireMessage readMqttWireMessage()`
at line 92:
`byte first = in.readByte();`
It tries to read input from a stream but it is empty since **is.available() =0** and thus throws the IOException
I think, in that case, you should skip the parsing of that message and avoid the call to that method from `CommsReceiver.run()`
Contributor guide
Assessment
This issue has not been assessed yet.