eclipse / paho.mqtt.python

paho.mqtt.python
Other
2.14k stars 724 forks source link

Memory leak issue? In a stable program, using the client generates crashes... #738

Closed coutiere closed 1 week ago

coutiere commented 12 months ago

[I'm pretty new to MQTT so I may use wrong terms. Sorry]. I am setting up a project where sensors send short data to a MQTT broker.

The data are received by a software ("Dashboard") written in Python. The Dashboard has a unique Paho client to receive data (and send sometimes), and it updates the interface with colors depending on the alert level. I use QT5 on Linux / Raspberry Pi OS, and QT6 on Win10, with similar issues.

Basically, when the Dashboard receives a message, the "on_message" procedure reads the data and sends them to "dealWithTheInfo" procedure. This one looks into an array of QPushButtons, selects the relevant one, and updates its stylesheet with button.setStyleSheet("backgound-color: red"). It's pretty straightforward, and I paid attention to the thread issues of QT.

I randomly get errors during the procedure where I modify the stylesheet:

When the Dashboard generates MQTT messages by itself, and sends them, it receives them back (same hash), sends the data to "dealWithTheInfo", and it sometimes falls into the bugs.

When the Dashboard generates the messages and sends them directly to "dealWithTheInfo", the software is stable.

Conclusion: the paho client is the source of the trouble.

I absolutely don't know how to investigate further. I strongly suspect a memory leak, but I understand I give very few clues to debug it...

Does this ring a bell to anyone? Thanks for any idea!

MattBrittan commented 7 months ago

understand I give very few clues to debug it

Unfortunately I think you are right and it's unlikely that we can do anything with the info presented. If you are able to generate a minimal, reproducible, example then that would really help us understand (if we cannot replicate an issue then it's a lot harder to understand/fix it - currently the issue may be in your code).

MattBrittan commented 1 week ago

I'm going to close this due wo inactivity, the fact there have been new releases in the interim, and an inability to replicate the issue.