-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Endless loop with external broker (client mode) #414
Comments
I have the same problems. After a certain time, the broker is flooded with the same messages over and over again. Is there already a solution to this? |
Same problem here. |
I tried really a lot of different settings. And i have another test instance of ioBroker running. Same behaviour there as wll. After a (short) while it begins with the loops and my ioBroker as well as my MQTT Broker use insane cpu and can't be used any more. Therefore i sadly stopped using the adapter completely. Even other versions didn't help. |
Please post details of your configuration and debug logs please |
Plattform: docker (official image - v9.1.1) on Raspberry Pi 4 MQTT Broker/Client: 5.2.0 Log:
Hopefully this helps. If there are more information that I can provide please let me know. |
I moved away from the internal mqtt broker cause of this error and am using emqx now. So not sure if I remember correctly but here is what I think what happens: For me it looked like there is a general problem of how this adapter is supposed to work. It seems to have two features that work against each other.
That means it publishes it's own messages again. This shouldn't be a problem in general as it's not publishing the same message if it didn't change, which is why it works at first, but if there happens to be quick changes after each other it flip flops back and forth as it receives both state changes. |
Is there any news on this, I have the problem every few days and then have to restart the adapter. |
Unfortunately, the problem still exists and makes it impossible to use this adapter! |
Describe the bug
Hi,
I currently for some reason end up in an endless loop with this adapter.
I have an external broker and try to listen to changes on there to generate iobroker objects in mqtt.0. ("patterns": "hpm/#, senec/#")
I've also set publish to "hm-rpc.0.*" to also publish homematic state to mqtt.
For some reason sometimes the adapter decides to not only publish state from "hm-rpc.0" but also from "mqtt.0" which then ends up in an infinite loop. This can even be forced by setting it to not only publish changes but instead publish always.
I think there are two issues here and I think I found at least one of them here:
ioBroker.mqtt/main.js
Lines 46 to 49 in bf6976c
If the adapter is set to client then it subscribes to changes for mqtt.0.. It is also set to subscribe to topic hpm/# so if someone else publishes a message e.g. hpm/readings/test, then a state is created in mqtt.0.readings.test resulting in a state change for mqtt.0. and the adapter then publishes this state again. The state has the native property "topic" set to "hpm/readings/test" which means iobroker will publish to the same topic again, then receive that change from the broker, change the local state and publish that change to the broker again....and again...and again.
I've now removed the above code piece completely and the loop is gone. I can't set states this way anymore but I don't need that.
The second issue I noticed is that it even happens when "publish only changes" is checked but it only happens irregularily. Either there is a problem in the change detection here:
ioBroker.mqtt/main.js
Line 241 in bf6976c
...or it happens when two messages for the same state is in the queue. That would mean it will flip flop from one state to the other.
Maybe there is also some issue with setting the new state to acknowledge which prevents change detection.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No sudden loop of messages
Versions:
The text was updated successfully, but these errors were encountered: