MQTT not stable FLM O2B 244

When reset FLM i do see port 8083 and all is working .
But sometimes just after 10 minutes and also sometimes up to 2 hours no messages are recieved and if i check the 8083 is down.
Only way to get it working again is to power down and up the FLM.

So the question is why does the port 8083 stops working and how can i reset this port without to power down the FLM.
Thx for your help.

icarus75's picture

MQTT over Websocket support is still considered experimental. If the FLM stops listening on port 8083, that could mean the whole MQTT broker went down as well. Next time you encounter this issue, could you execute the below command form a Linux/OSX terminal. Just post the output in a comment.

  1. $ ssh root@192.168.255.1 "ps"

Ssh password is "root".

gebhardm's picture

As I understood Peter (we had some correspondence on this already as he uses the FLM local visualization) the FLM freezes and can only be revitalized by a reboot. Also I understood that Peter seems to keep a visualization page just running.
I could not reproduce the behavior on my 2A; yet I recognized that when I switch between, say the panel and the gauge, then the MQTT client is not closed on page change (potentially an issue in my scripts) and reopened but seems to toggle resulting in a sequence of connection closes and opens - when refreshing the page from the browser (reload) all is OK...

Peter.gooren@ziggo.nl's picture

Was active after a total reset (60 seconds) for more then 3 days via wifi, just this evening the 8083 port is down again.

Thx for your help.

root@flukso-a75973:~# "ps"
PID USER VSZ STAT COMMAND
1 root 1516 S init
2 root 0 SW [kthreadd]
3 root 0 SW [ksoftirqd/0]
6 root 0 SW< [khelper]
7 root 0 SW [kworker/u:1]
43 root 0 SW [sync_supers]
45 root 0 SW [bdi-default]
47 root 0 SW< [kblockd]
81 root 0 SW [kswapd0]
82 root 0 SW [fsnotify_mark]
99 root 0 SW [mtdblock0]
104 root 0 SW [mtdblock1]
109 root 0 SW [mtdblock2]
114 root 0 SW [mtdblock3]
119 root 0 SW [mtdblock4]
124 root 0 SW [mtdblock5]
129 root 0 SW [mtdblock6]
150 root 0 SW [kworker/0:1]
292 root 0 SWN [jffs2_gcd_mtd3]
336 root 0 SW< [cfg80211]
381 root 0 SW< [spi_gpio.1]
402 root 1528 S /sbin/syslogd -C16
404 root 1508 S /sbin/klogd
406 root 848 S /sbin/hotplug2 --override --persistent --set-rules-f
414 root 888 S /sbin/ubusd
428 root 1488 S /sbin/netifd
493 root 1520 S /sbin/watchdog -t 5 /dev/watchdog
587 root 0 SW [kworker/0:2]
619 root 1620 S wpa_supplicant -B -P /var/run/wifi-wlan0.pid -D nl80
621 root 832 S wpa_cli -i wlan0 -p /var/run/wpa_supplicant-wlan0 -a
670 root 1528 S udhcpc -p /var/run/udhcpc-wlan0.pid -s /lib/netifd/d
673 root 1532 S /usr/sbin/crond -c /etc/crontabs -l 1
693 root 1160 S /usr/sbin/dropbear -P /var/run/dropbear.1.pid -p 22
710 root 1172 S /usr/sbin/uhttpd -f -h /www -r flukso-a75973 -x /cgi
729 root 1164 S /usr/sbin/uhttpd -f -h /www -r flukso-a75973 -x /sen
763 nobody 964 S /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf
769 nobody 1744 S avahi-daemon: running [flukso-a75973.local]
798 root 2800 S /usr/sbin/supd
801 flukso 2928 S /usr/sbin/spid -u flukso
804 flukso 5416 S /usr/sbin/fluksod -u flukso
807 flukso 5236 S N /usr/sbin/tmpod -u flukso
813 flukso 2440 S /usr/sbin/parsed -u flukso
816 flukso 6084 S /usr/sbin/kubed -u flukso
840 root 1524 S /usr/sbin/ntpd -n -p 0.openwrt.pool.ntp.org -p 1.ope
1714 root 0 SW [kworker/u:0]
16347 root 1224 R /usr/sbin/dropbear -P /var/run/dropbear.1.pid -p 22
16348 root 1524 S -ash
16353 root 1516 R ps

Peter.gooren@ziggo.nl's picture

As you can see task 781 flukso 3420 S /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf is not in the list, does this mean Mosquitto is not running anymore?
After a reset task 781 is active, how can we activate mosquitto without reset the FLM?

gebhardm's picture

Simply by /etc/init.d/mosquitto restart

  1. Syntax: /etc/init.d/mosquitto [command]
  2.  
  3. Available commands:
  4.         start   Start the service
  5.         stop    Stop the service
  6.         restart Restart the service
  7.         reload  Reload configuration files (or restart if that fails)
  8.         enable  Enable service autostart
  9.         disable Disable service autostart

Peter.gooren@ziggo.nl's picture

Thx Gebhardm,

I must do something wrong again, commands are not accepted, see below.
I use putty and login as root.

root@flukso-a75973:/etc/init.d# ls
avahi-daemon done led sysctl umount
boot dropbear mosquitto sysntpd usb
cron firewall network ubus watchdog
dnsmasq flukso rcS uhttpd
root@flukso-a75973:/etc/init.d# mosquitto restart
Error: Unknown option 'restart'.
mosquitto version 1.4 (build date 2014-09-16 15:53:30+0200)

mosquitto is an MQTT v3.1 broker.

Usage: mosquitto [-c config_file] [-d] [-h] [-p port]

-c : specify the broker config file.
-d : put the broker into the background after starting.
-h : display this help.
-p : start the broker listening on the specified port.
Not recommended in conjunction with the -c option.
-v : verbose mode - enable all logging types. This overrides
any logging options given in the config file.

See http://mosquitto.org/ for more information.

root@flukso-a75973:/etc/init.d#

gebhardm's picture

Note that there is the mosquitto broker, the application program reachable through the path-variable, and the mosquitto daemon, which are different; what you accessed by "mosquitto", even in the /etc/init.d directory, is the broker, not the daemon; in /etc/init.d you actually would have to address the daemon by ./mosquitto restart - therefore I stated /etc/init.d/mosquitto restart exactly in this way... - welcome to the world of "real" operating systems ;-)

Peter.gooren@ziggo.nl's picture

Thx for your help, yes iam a nitwit sorry for that but i must say , i did learn a lot.
Last few weeks i was travelling so that’s why i did not tried anything.

Now i know how to reset, but still the question is why is the mosquito task stopped.
To my opinion it has nothing to do with wireless or lan network because when i did shut down the wireless and connected lan direct it was down within a few hours.
Just when i give the FLM a total reset ( which you did recommend already weeks ago, but i was a little afraid to do because for the rest all was/is working well ) it stayed in the air (8083) for more than 3 days.

So i gonna monitor and let you know what my findings are, i saw already when i connected via 192.168.255.1 to mqtt and at the same time with the wireless, broker does not like that, the interval of updating screens will go really up, so maybe its better to bring down the interval to for example every 30 seconds?

gebhardm's picture

Update is performed on receiving a subscription, so there is actually no idle period to alter - which again indicates there seems to be an issue with the mosquitto broker in the first place; anyone else having an issue? Community, please respond!

jgysenbergs's picture

Runs AOK over here after ./mosquitto restart, lost sensor names though but that's nothing to worry about.

jgysenbergs's picture

Tata, sensor names are back after a reboot. Even Chuck Norris would switch to MQTT.

gebhardm's picture

Reboot? Or page refresh? Only a page refresh should be required...

Peter.gooren@ziggo.nl's picture

Sensor names does only come back after a reboot, reset Mosquitto and refres/ del cache explorer will not bring the names back.

gebhardm's picture

OK, understood, as the fluksod.lua does not resend the config-topic on a mosquitto restart; and the mosquitto cache of retained messages is empty... - so, actually "only" a fluksod restart would be required ;-)
Bart, here we have a deadlock...

icarus75's picture

@peter.gooren I've just re-compiled a FLM firmware with updated packages for mosquitto and libwebsockets. Care to take the firmware for a spin and check whether the websocket crash keeps occuring?

Care to provide some additional details wrt your test setup? What browser/client (+version) are you using? Are these @gebhardm's visualisation patches you're using?

jgysenbergs's picture

Could you upgrade mine too? Firmware is system.cfg02e48a.version=244 Thanks!

Peter.gooren@ziggo.nl's picture

@Icarus75, yes iam ready for a spin! thx.

FL03001288
Win7
Firefox35.01
Yes Gebhardm patches (unmodified}
Android , firefox
Please let me know when updated.
Thx.

icarus75's picture

@peter.gooren @jgysenbergs Both your FLMs are now scheduled for an upgrade to r245, which should take place within the hour. @gebhardm's patches will have to be re-applied after the upgrade.

Peter.gooren@ziggo.nl's picture

@Icarus75, r244, after a reset, what do i need to do/?

icarus75's picture

Just re-scheduled the firmware upgrade. Check again within the hour.

jgysenbergs's picture

Just a quick roundup from OSX Yosemite: Safari, FF 36 and Chrome all running Flukso graphs OK except for the minute tab -> no succes with Chrome Version 39.0.2159.4 dev (64-bit), FF -> success after disabling protection, Safari is AOK as is.

I'm pressed for time today so more testing next week after implementing Markus's patches (must have a look at these 'Show arbitrary sensors' as I have lots of sensors floating around the house).

As always, kudos and thanks to Bart and Markus. Flukso kicks -ss!

Peter.gooren@ziggo.nl's picture

Big difference, Iphone/Ipad Safari, Android Chrome and frirefox , Win 7 Chrome Firefox IE11, all working! Chapeau, at the moment only connected with wifi, tested several connections at the same time, and until now looking very promising. It took a little while but result is impressive. thx Bart and Markus.
End of this week i will report again.

Peter.gooren@ziggo.nl's picture

After almost 2 weeks still up and running. Well done guys.

jgysenbergs's picture

Same over here. Also, got Markus's FluksoChart running, not in Safari though (which says something about Safari ...).

gebhardm's picture

To be fair, currently there are two competing bootstrap.CSS versions on the FLM... I use a newer one than Bart. So will dig into that and thus call it " says something about web development and compatibility "

Peter.gooren@ziggo.nl's picture

11 Apr 2015 16:02:03 42d 4h and still working.(also with Safari)
For me this is finished, thx Markus and Bart.

vk2him's picture

With the problems I am having trying to get Markus' Chart script to work via mqtt (see other long thread), I would like to try running FluksoChart via websocket on the FLM - any chance of remote updating my firmware please ? Thanks