eclipse-paho / eclipse-paho/paho.mqtt.java
Possible bug for replacing clean with another clean session?
- Dominant language
- Java
- Stars
- 2.3k
- Forks
- 919
- PR merge metrics
- No merged PRs in 30d
Description
In https://github.com/eclipse/paho.mqtt.java/blob/master/org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal/CommsReceiver.java#L177-L182 we throw exception if not in `isDisconnecting()` state. I am seeing transient `EOF Exceptions` thrown from aforementioned line when I re-connect a clean session using the same `MqttClient` object.
I.e.
```
MqttClient subscriber = createSyncMqttClient(subscriberClientId);
subscriber.connect(createConnectOptionsWithCleanSession(true));
subscriber.subscribe(topic, 1);
subscriber.disconnect();
// EOF Exception thrown transiently upon executing this line
IMqttToken token = subscriber.connectWithResult(createConnectOptionsWithCleanSession(true));
```
I suspect this is is because the broker is sending EOF but since we are trying to connect back that exception is thrown? Is this possible? Thanks in advance.
I notice if I use a different `MqttClient` to re-connect then this won't happen.
- [ ] Bug exists Release Version 1.2.0 ( Master Branch)
- [ ] Bug exists in MQTTv3 Client on Snapshot Version 1.2.1-SNAPSHOT (Develop Branch)
- [ ] Bug exists in MQTTv5 Client on Snapshot Version 1.2.1-SNAPSHOT (Develop Branch)
Contributor guide
Assessment
This issue has not been assessed yet.