paho.mqtt.java
paho.mqtt.java copied to clipboard
ConcurrentModificationException when calling unsubscribe
- [x] Bug exists Release Version 1.2.5 ( Master Branch)
- [x] Bug exists in MQTTv3 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
- [x] Bug exists in MQTTv5 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
When subscribing to topics with a topic specific message listener on the AsyncClient (i.e calling MqttAsyncClient.subscribe([]MqttSubscription, Object, MqttActionListener, IMqttMessageListener, MqttProperties
an unsubscribe
later runs into the ConcurrentModifcationException.
This is caused here because the the Map is modified (by calling remove
) without using the iterator.
So when using topic specific subscriptions it doesn't seem possible to unsubscribe right now.