foris-client issueshttps://gitlab.nic.cz/turris/foris-controller/foris-client/-/issues2024-03-07T16:46:20+01:00https://gitlab.nic.cz/turris/foris-controller/foris-client/-/issues/9paho-mqqt breaking changes between versions2024-03-07T16:46:20+01:00Filip Hronpaho-mqqt breaking changes between versions_paho-mqtt_ library introduced some breaking changes in it's API, see: https://github.com/eclipse/paho.mqtt.python/blob/v2.0.0/docs/migrations.rst
This fails multiple CI jobs
for example [sample module](https://gitlab.nic.cz/turris/for..._paho-mqtt_ library introduced some breaking changes in it's API, see: https://github.com/eclipse/paho.mqtt.python/blob/v2.0.0/docs/migrations.rst
This fails multiple CI jobs
for example [sample module](https://gitlab.nic.cz/turris/foris-controller/foris-controller/-/jobs/1035150):
```console
self = <foris_controller_testtools.infrastructure.MqttInfrastructure object at 0x7fc36bb2be50>
def start_message_bus(self):
kwargs = {}
if not self.debug_output:
devnull = open(os.devnull, "wb")
kwargs["stderr"] = devnull
kwargs["stdout"] = devnull
mosquitto_path = os.environ.get("MOSQUITTO_PATH", "/usr/sbin/mosquitto")
self.mosquitto_instance = subprocess.Popen(
[mosquitto_path, "-v", "-p", str(MQTT_PORT)], **kwargs
)
# wait for mqtt port to be opened
> client = mqtt.Client()
E TypeError: __init__() missing 1 required positional argument: 'callback_api_version'
```Štěpán HenekŠtěpán Henekhttps://gitlab.nic.cz/turris/foris-controller/foris-client/-/issues/8Using the foris-client (mqtt) does not clean up subscriptions2020-10-22T12:26:25+02:00Christoph MetzUsing the foris-client (mqtt) does not clean up subscriptionsHi,
i did some monitoring of the $SYS/broker/retained messages/count and $SYS/broker/subscriptions/count channels to check whether my continuous requests against the foris-bus (mqtt) are generating some "data leak". The result was an i...Hi,
i did some monitoring of the $SYS/broker/retained messages/count and $SYS/broker/subscriptions/count channels to check whether my continuous requests against the foris-bus (mqtt) are generating some "data leak". The result was an increasing subscription count every time i invoked the client.
I did some research and the main reason is probably the setting "clean_session=False" in the mqtt implementation is preserving the subscriptions for a reconnect. but as the client is always generating a new client id, it is never reused, when invoked by hand e.g. with foris-client-wrapper. also the unsubscribe in the mqtt (ReplyListener) implementation is never called when the client exits.
In a permanent running program this is probably no issue, but when the client is used e.g. in a cronjob this could lead to a increased memory usage of mosquito, with other side effects.
I modified the client to use clean_session = True and this behavior is gone, as mosquito is cleaning the sessions after the disconnect. So i think there are two solutions to this problem, make the clean_session configurable and default to true and only use none clean session for long running programs, or fix the cleanup behavior, e.g. moving from run_loop_forever to loop_start/loop_stop. so it can be cleaned up before the disconnect.
I'm quite new to mqtt / paho so maybe i'm wrong here.
Regards Christoph - (loom - turris forum)