eclipse-archived / smarthome

Eclipse SmartHome™ project
https://www.eclipse.org/smarthome/
Eclipse Public License 2.0
862 stars 787 forks source link

[MQTT 2.4] action stops functioning #6780

Open 911rgt opened 5 years ago

911rgt commented 5 years ago

Expected Behavior

Continued publishing of Mqtt messages.

Current Behavior

After upgrading 2.4 and switching to MQTT 2 I recreated the event-bus like behaviour with the following rule:

rule “Publish item changes” when Member of gTemperature changed then var state = “” if (triggeringItem.state != null) { state = triggeringItem.state.toString val actions = getActions(“mqtt”,“mqtt:broker:myBroker”) actions.publishMQTT("/myserver/"+triggeringItem.name+"/state",state) logInfo(“log”, "publish: " + triggeringItem.name + " " + state) } end

While this rule works as expected it stops functioning after several hours and throws an error like: MQTT publish to failed!

The rule creates maximum 20 messages per minute so the load isn't that high.

I tried this on 2 different OpenHAB setups (one RPI 3b and one a more powerful VM) and same result.

Other users have reported similar behaviour.

Possible Solution

David Graeff suggested that this is related to the new publishMQTT action itself and that this might not be stress tested yet.

Steps to Reproduce

Create a rule as above which gets triggered frequently Wait a few hours (max 24 hours) Your Environment

openhab 2.4 release raspian jessie and ubuntu 16.04

davidgraeff commented 5 years ago

Kai has worked on getActions recently and it might be fixed by his changes. Need to be tested at some point.

philippwaller commented 5 years ago

I can confirm this issue. After a couple of hundred successful calls, I get the message "MQTT publish to openHAB/out/item/vBD_LightScene/ItemStateEvent failed!". I use JSR223 Groovy Script instead of Xtend and initiate the MQTTAction at script execution time as a global variable via the ScriptServiceUtil.getActionServices() method. At time of rule execution, I load the instance from the global variable and don't call any factory method. So in my case, the issue appears after object creation. I have the feeling that the error is caused by a certain load. If I quickly turn on and off 25 Hue lamps with 6 channels each and publish the state changes to the broker (300-400 msg/sec), I get the error message earlier. (NAS with 4x1,6Ghz Intel Celeron & 8GB RAM, Dockerized)

davidgraeff commented 5 years ago

Can anybody confirm this with a 2.5m1 version?

pavel-kamaev commented 5 years ago

Still reproducible in 2.5M1.

davidgraeff commented 5 years ago

Ok. This issue need to recreated on the openhab2 repository though. I will forget about it, if it is sitting here

pavel-kamaev commented 5 years ago

There is one already: https://github.com/openhab/openhab2-addons/issues/4498