eclipse-paho / eclipse-paho/paho.mqtt.java
manual acknowledgement results in duplicate pubcomp
- 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
**ISSUE DESCRIPTION**
Setting manual acknowledgement to true and calling the message arrived complete method results into duplicate pubcomp and the connection gets disconnected. In short, manual acknowledgement is not possible.
**SNIPPET TO REPRODUCE**
```java
var client = ...;
client.setManualAcks(true);
client.setCallback(new MqttCallback() {
...
@Override
public void messageArrived(String topic, MqttMessage message) {
...
client.messageAriveComplete(message.getId(), 2);
...
}
...
});
client.subscribe(...);
```
**Result**
```bash
Creating MqttPubComp due to manual ACK: MqttPubComp [returnCode=0, properties=MqttProperties [validProperties=[...]]]
Creating MqttPubComp: MqttPubComp [returnCode=0, properties=MqttProperties [validProperties=[...]]]
MqttDisconnectResponse [returnCode=0, reasonString=null, userProperties=null, serverReference=null, exception=Connection lost (32109) - java.net.SocketException: Connection reset]
```
Contributor guide
Research direction
Start with the Java client's manual-acknowledgement path around setManualAcks(true), messageArrived, and messageAriveComplete(message.getId(), 2), then reproduce the supplied snippet on release 1.2.5. Trace the two logged MqttPubComp creations; done means one acknowledgement is produced and the connection remains established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100