Adafruit_MQTT_Library icon indicating copy to clipboard operation
Adafruit_MQTT_Library copied to clipboard

Silent Limit on the number of subscribed topics, callback ignored

Open joihn opened this issue 2 years ago • 1 comments

Env: Esp8266, communication via TLS

Symptom: When too many subscriber are registered, the last few one will never execute their callback.

reproducing Subscribe to multiple topics (17 in my case) with this syntax

Adafruit_MQTT_Subscribe trigg1 = Adafruit_MQTT_Subscribe(&mqtt, "triggTopic1", MQTT_QOS_1);
trigg1.setCallback(foo);
mqtt.subscribe(&trigg1);
Adafruit_MQTT_Subscribe trigg2 = Adafruit_MQTT_Subscribe(&mqtt, "triggTopic2", MQTT_QOS_1);
trigg1.setCallback(bar);
mqtt.subscribe(&trigg2);

etc... The last few subsriber will get ignored, silently (!!!!!) (they will never execute their callback, despite a successfull compilation, thus very confusing to debug ) There seems to be a silent hidden limit on the max. number of subscribed topics.

joihn avatar Dec 10 '22 14:12 joihn

there is indeed a limit https://github.com/adafruit/Adafruit_MQTT_Library/blob/master/Adafruit_MQTT.h#L126

Maybe a verbose failure when exceeding it would be a good idea.

joihn avatar Dec 10 '22 14:12 joihn