eclipse / paho.mqtt.java

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

ConcurrentModificationException of the HashMap callbackTopicMap #645

Open faenschi opened 5 years ago

faenschi commented 5 years ago

Please fill out the form below before submitting, thank you!

If this is a bug regarding the Android Service, please raise the bug here instead: https://github.com/eclipse/paho.mqtt.android/issues/new

The Java library seems to have the same issue as reported here in the Android Service: https://github.com/aws-amplify/aws-sdk-android/issues/329

aalmazanarbs commented 5 months ago

The problem continues in 2024 with such a simple solution:: src/main/java/org/eclipse/paho/mqttv5/client/internal/CommsCallback.java

this.callbackMap = new ConcurrentHashMap<>();
this.callbackTopicMap = new ConcurrentHashMap<>();
this.subscriptionIdMap = new ConcurrentHashMap<>();