eclipse / paho.mqtt.javascript

paho.mqtt.javascript
Other
1.15k stars 467 forks source link

Freezing browser with Mosquitto 1.5 #169

Open tim-bitreactive opened 6 years ago

tim-bitreactive commented 6 years ago

Code that ran fine with mosquitto 1.4.15 stopped working with mosquitto 1.5 and freezes the browser. The issue can be replicated by running the sample code from the project main page. In the development console thousands of executions of the 'onConnect' method can be seen. It seems some out-of-control loop is freezing up the browser.

telemac commented 6 years ago

I have the same behavior with mosquito 1.5

lnowakowski commented 6 years ago

Also same here after mosquitto upgrade

Pepper-Ng commented 6 years ago

same here, mosquitto 1.5 All websockets implementations based on Paho javascript have this issue, onconnect keeps firing in an infinite loop, causing everything else to freeze up.

icraggs commented 6 years ago

Are there any messages on the Mosquitto console which explain the inability to connect?

lnowakowski commented 6 years ago

Haven't seen nothing unusual on Mosquitto side, only this infinite loop on client side

tim-bitreactive commented 6 years ago

Same here, nothing unusual on the mosquitto side, just lock-up at 100% in the front-end.

On 2 August 2018 at 15:46, Lukasz Nowakowski notifications@github.com wrote:

Haven't seen nothing unusual on Mosquitto side, only this infinite loop on client side

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eclipse/paho.mqtt.javascript/issues/169#issuecomment-409931720, or mute the thread https://github.com/notifications/unsubscribe-auth/ARXZNXT_ZpXV6pW1dcMtT-SaobRAdDQGks5uMwLPgaJpZM4VKy7R .

-- Dr.-Ing. Tim Jagenberg Chief Technology Officer

Bitreactive AS http://www.bitreactive.com/

icraggs commented 6 years ago

I just tried this on Ubuntu with Mosquitto 1.5, and both the latest Paho JS client, and the utility at: http://www.eclipse.org/paho/clients/js/utility/, and both worked fine. This was without TLS.

Are you all using TLS? If so, can you see if it works without TLS? Any other factors at work here?

tim-bitreactive commented 6 years ago

No, we did not use TLS. Which architecture did you run the test on? For us mosquitto was always on armhf, the client on both, armhf and amd64. We are using the jessie versions, not stretch.

icraggs commented 6 years ago

Both client and server were on the same machine, amd64. I could try on an ARM architecture machine - Raspberry Pi. Can you start the JS console on the browser first and see if there are any useful messages?

bergie commented 6 years ago

We're also seeing this with msgflo-browser (which uses this library underneath) when connecting to mosquitto 1.5 from Debian. No TLS, no auth. Mosquitto runs on x86, but same failure occurs on both x86 and ARM (RPi3) clients on Chrome and Firefox.

Nothing in Console or Network tabs, and the browser process becomes unresponsive.

msgflo/msgflo-browser#7

Code: https://github.com/c-base/infoscreens/blob/master/infodisplay/infodisplay.js

icraggs commented 6 years ago

@bergie where, on what platform, is Mosquitto 1.5 running?

mykolaspocius commented 6 years ago

I have the same issue. Mosquitto 1.5 running on rpi. Client on windows. I get infinite onConnect event firing. I checked mosquito logs and looks like there all is fine. Connects once and when i close browser -disconnects.

bergie commented 6 years ago

@icraggs as stated in the ticket:

All of the clients (as well as multiple versions of this library) exhibited the same infinite loop and freezing when connecting to mosquitto 1.5. The only fix we've found was to downgrade the mosquitto broker.

jbaans commented 6 years ago

Hi, I've had similar issues, explicitly setting mqtt protocol version helped.

bergie commented 6 years ago

@jbaans interesting. What value worked?

jbaans commented 6 years ago

for the JS client you can try: with mqttVersionExplicit: true, set either mqttVersion: 3 (mqttv3.1) or mqttVersion: 4 (mqttv3.1.1)

Actually I just double checked and noticed I installed mosquitto git version 4f838e5 explicitly (configured build WITH_WEBSOCKETS:=yes), this could also explain why I have no trouble. Note protocols v3.1.1 and v3.1 work differently (see mosquitto.conf).

vonnieda commented 5 years ago

Same problem, and happens with MQTT.js and Hive client too.

sureshtsl commented 5 years ago

I had the same issue. Everything worked after reinstalling Mosquitto with websocket enabled as per the post https://gist.github.com/smoofit/dafa493aec8d41ea057370dbfde3f3fc

cok666n commented 4 years ago

So has anyone found a fix for this? I'm having the same issue with CloudMQTT, so I unfortunately cannot rollback to a specific version of the broker.

Dacesilian commented 3 years ago

I probably have the same problem. It's insane that this issue is opened for so long. :(

vonnieda commented 3 years ago

@Dacesilian and @cok666n: This is an issue with mosquitto. You can fix it by recompiling with the correct websockets library. See https://github.com/eclipse/mosquitto/issues/1050.

Dacesilian commented 3 years ago

@vonnieda Thank you! I've installed mosquitto 1.6.12-1 with apt-get -t testing install mosquitto, will see if it helps. Previously I was using version 1.5.7-1+deb10u1.

cok666n commented 3 years ago

Sorry I never got back to comment, it was indeed and issue with the mosquitto broker, but since it wasn't in my control (cloud based 3rd party broker) I couldn't do much to fix it.

I ended up having a few back and forth with the support of that provider, and they eventually fixed the issue. They never admitted to using a new version of the broker like I suggested though.

Dacesilian commented 3 years ago

Using Debian package from testing repository probably doesn't solve the issue, so another possibility is to use package for Debian directly from Mosquitto, as written here - https://mosquitto.org/blog/2013/01/mosquitto-debian-repository/ .

apt-cache policy mosquitto
sudo apt-get install mosquitto=1.6.12-0mosquitto1~buster1
AndreVanKammen commented 2 years ago

I also just ran into this issue I did an upgrade on my Raspberry Pi Debian Jessie which installed mosquitto 1.5.8 and now my javascript client breaks. This thing has been running for years without a hick-up, I just wanted to add some p1 smartMeter support to my own Home automation running on Mosquitto some esp's and a javascript client. I managed to downgrade it to mosquitto 1.4.15 so it works again for now.

I've basicly come to the conclussion that my old Pi installation is useless. Outdated, nothing works on it anymore, just another disapointing everything breaks because the community moves on to the latest new and shiny. Every python thing I try is broken. Nodejs is unupgradable because of missing libstd support and now I've broken my mosquitto by installing the latest jessie supported version. I already had to find a mirror thats still supported it because Debian completly removed Jessie. Trying to upgrade Jessie also breaks on several points.

I'll just make a new install for my Rapsberry pi and set everything up again from scratch which is mostly my experience with linux, after a while it's just broken because the community makes it impossible to install new stuff on an old OS. It turns into one big dependancy problem which reminds me of the DLL hell in windows.