eclipse / paho.mqtt.python

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

Multiprocessing: publishing with qos2 hangs at the moment of sending PUBREL. #743

Closed annt0 closed 1 week ago

annt0 commented 11 months ago

I have extended paho.mqtt.client.Client in another custom class that I use in my program. The structure of my program is as follows:

Main thread with custom MQTT client c1. -- Process 1 (daemon) with custom MQTT client c2.

c1 works correctly, but c2 is unable to send messages with qos2. I have tried two approaches:

In the first case, communication stops in c2 at the sending of PUBREC by the broker: The call to PUBLISH by c2 is logged, I see the sending of PUBREC on the broker (Mosquitto), c2 receives PUBREC, but what I noticed while debugging your client.py is that something empties the self._out_messages dictionary, and therefore, the call to self._send_pubrel(mid) cannot be made. In the second case, c2 successfully publishes the message, but it never arrives at the broker.

With lower qos levels, everything works fine. c1 does not have these problems.

Could you tell me what could be causing this? Thank you in advance!

MattBrittan commented 6 months ago

Apologies for the long delay. Unfortunately I think its going to be difficult to assist without seeing some of your code (there are too many variables here) are you able to provide a reproducible example? (client logs may also be useful).

MattBrittan commented 1 week ago

Closing due to age/inactivity. If this is still an issue and you can provide logs then please feel free to reopen.