[SOLVED] MQTT Embedded Crashed Will Not Restart

Hardware: Intel Q9650 on Dell 0G261D motherboard
OS: Ubuntu 18.04.1 LTS
JRE: OpenJDK 1.8.0_192
OpenHAB 2.5.0.M3

I started a thread sometime back by trying to use Mosquitto, ended up going with the embedded broker and worked to get it running, then to pull temperature data from a Sonoff TH16. I was successful for a few minutes before the broker stopped working and I’ve not been able to get it running again. That thread was solved (perhaps prematurely) so I’m moving over here.

Original thread:

Where I am today

  • Recently updated to 2.5.0.M3
  • The “MQTT Broker Moquette 2.5.0.M3” was installed
  • The “MQTT Binding 2.5.0.M3” was installed
  • I did not install the suggested MQTT thing; I have a bridge, thing and channels in a .things file as:
Bridge mqtt:broker:mqttbroker "MQTT Broker" [ host="127.0.0.1", secure=false, port=1883, qos=0, retain=false, clientID="openhab", keep_alive_time=30000, reconnect_time=60000 ]
{
    Thing topic Sonoff_Coop_Thing "Sonoff Coop" @ "openhab" {
    Channels: 
        Type switch : power "Power" [ stateTopic="stat/Sonoff_Coop/POWER", commandTopic="cmnd/Sonoff_Coop/POWER" ]
        Type number : temperature "Temperature" [ stateTopic="tele/Sonoff_Coop/SENSOR", transformationPattern="JSONPATH:$.SI7021.Temperature"]
        Type number : humidity "Humidity"       [ stateTopic="tele/Sonoff_Coop/SENSOR", transformationPattern="JSONPATH:$.SI7021.Humidity"]
    }
}

My .items file contains:

Switch Sonoff_Coop_Power "Coop Switch" <switch> { channel="mqtt:topic:mqttbroker:Sonoff_Coop_Thing:power"}
Number Sonoff_Coop_Temperature "Coop Temperature [%.1f °F]" <temperature>  { channel="mqtt:topic:mqttbroker:Sonoff_Coop_Thing:temperature"}
Number Sonoff_Coop_Humidity "Coop Humidity [%s %%]" <humidity> {channel="mqtt:topic:mqttbroker:Sonoff_Coop_Thing:humidity"}

The broker was working right up to the time that the Temperature data started displaying from my Sonoff TH16 on my sitemap, then suddenly the broker just stopped working.
My openhab.log file is continuously displaying the following entries:

2019-10-08 20:20:18.172 [INFO ] [.reconnect.PeriodicReconnectStrategy] - Try to restore connection to '127.0.0.1'. Next attempt in 10000ms
2019-10-08 20:20:18.173 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '127.0.0.1' with clientid openhab and file store '/var/lib/openhab2/mqtt/127.0.0.1'

And the events.log repeats:

2019-10-08 20:21:48.192 [hingStatusInfoChangedEvent] - 'mqtt:broker:mqttbroker' changed from OFFLINE (COMMUNICATION_ERROR): Unable to connect to server to OFFLINE
2019-10-08 20:21:48.197 [hingStatusInfoChangedEvent] - 'mqtt:broker:mqttbroker' changed from OFFLINE to OFFLINE (COMMUNICATION_ERROR): Unable to connect to server

I’ve uninstalled the broker and binding and rebooted, no change. It’s all uninstalled now as it was filling my log files.
There is a file called “mqttembedded.bin” that was created in /var/lib/openhab2 that includes a lot of characters in addition to my .things file entries. Could this file be corrupt? What if I deleted the file and restarted openHAB?

Deleting and allowing the mqttembedded.bin file to rebuild didn’t work; MQTT broker will still not connect

I seem to be having the same issue now. I installed REST Documentation a few minutes ago, and somehow now my embedded MQTT broker does not work anymore… I am getting the same log entries:

2019-10-12 23:08:56.444 [INFO ] [.reconnect.PeriodicReconnectStrategy] - Try to restore connection to 'localhost'. Next attempt in 10000ms
2019-10-12 23:08:56.526 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to 'localhost' with clientid paho162223709015 and file store '/var/lib/openhab2/mqtt/

:frowning:

Mario: that you were installing REST docs caught my eye. There has been an ongoing issue with people having problems with the REST docs. This is ongoing discussion on github and recent thread where user tracked down what was buggering up his REST docs and might provide you some clues

David: What drew your attention to this file?
Recently I upgraded from OpenHAB version 2.4 stable to version 2.5M3. The upgrade went well except it broke my embedded mqtt broker. It was a different issue then you are having but might provide clues. Here is a post with the solution to my issue

Hi Andrew: As removing/reinstalling wasn’t working I assumed there was something out in my files that was persistently causing an issue. I looked extensively through the community pages but somehow missed your referenced post; I’d discovered the file on my own.
Even more interesting, I just ensured the file was removed and reinstalled the broker and binding…and it’s working! I’m unsure what’s different now, maybe there was something else in the cache.
At any rate, I was offered two things to add and added them both. They’re both named “MQTT Broker,” one is “mqtt:systemBroker:mqtt-broker” and the other is “mqtt:systemBroker:embedded-mqtt-broker.” Do I need them both?
Since this setup seems happy, I’m going to try to forego the .things file that sets my bridge; are there some examples of how to define channels w/in the binding?
Thanks again!

Craziness. I reloaded my original .things file, and it’s all running like a champ. Of course I now have three broker things and I kind of nervous about deleting anything…
image

Something is buggered
I think you have stuff remaining from your old broker. Did you clear the cache? I am getting ready to update that thread because my file lock issue is reoccurring on every restart

I haven’t cleared the cache yet; I end up with issues to fix every time I do. But I can ignore a few things for the time being. Once I get tired of looking at them I’ll get brave and try removing them.

you are right, I just did it and… issues
OpenHAB is kind of a hobby for me and I live alone so… guess it keeps me busy.

I appreciate the check for solution but we’ve only managed to get the broker running, we haven’t solved the problem. My issue on git hub (linked in the thread I posted above) is getting no response and the developer who owns the code is no longer active in OpenHAB development

Well, it looks like installed the REST Docs kind of screwed up my openHAB completely. Not sure what to do. Now it even looks like no bindings are installed anymore, MQTT still doesn’t work. I upgraded from 2.5.0 M1 to M3, nothing changed.

I am thinking about installing from scratch.

That’s sad :roll_eyes:

For people who find this thread, the issue I reported on git hub was closed because another issue had already been open for the same problem. This issue has been open since April 29 and although the developer original replied, there doesn’t seem to be to much going on to try to cure the issue. Here is a link in case you have this issue

There is some weird stuff going on in the system. I needed to restart openhab due to some other changes and it broke the MQTT broker. I needed to uninstall the broker and binding, delete the mqttemedded.bin file and restart, and its working again. Not an optimal solution…

Jan has looked in to this issue.

1 Like