-
Notifications
You must be signed in to change notification settings - Fork 1.4k
MQTT keepalive less than 60s and chrome 88 intensive timer throttling #1257
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
Comments
Just to add a bit of detail to this, it is absolutely an issue. It only happens during long periods of idle time (i.e. no message traffic), where the only traffic is pingreq/pingresp. The default keepalive setting of 60 seconds causes the pingresp to be "missed", so the connection is closed (perhaps this could be fixed internally to mqtt.js, to look for the pingresp message before closing the connection, which I'm assuming is driven by some kind of timer event). But the quick fix is to extend the keepalive timer; I used 120 seconds (but it's possible that 90 seconds or something else between 60 and 120 seconds would also work). Once Chrome starts its "intensive timer throttling", is a noticeable delay develops between pingreq and pingresp (which is usually sub-second with our broker), but with the longer keepalive interval, the pingresp message is "seen" before the connection is closed. |
Hi,
On another thing would be to solve the reconnection which will not occur on reconnectperiod because of the throttling. One thing that could be done would be to shedule the reconnection on the close event
|
In my case, as a work around, I offloaded the Examples are in TS
Hopefully this can help someone else as it did for me. Please point out any flaws in my logic to help myself and others that my run into this issue. |
@carloscolombo I see the following flaws in your solution
|
I also encountered this problem, thanks for the reminder. I seem that setting the pingResp on "packetreceive" solves this issue.
|
@kroutal could you explain what that's actually doing?
|
@hoIIer This is the current workaround I'm using:
Each time a ping message is sent by the client. The server will send back a ping response and trigger the 'packetsend' callback. Since this is done through a websocket this will not be impacted by the throtling. Within the callback the call to _shiftPingInterval() will restart the ping timer. The throtling will only start after the second tick of the timer. |
This is an automated message to let you know that this issue has If this issue is still important, you can simply comment with a Thank you for your contribution. |
This issue was automatically closed due to inactivity. |
Hi everyone. I started helping maintaining this library. It would be super helpful if someone of you could write a solution to this on docs and/or even better try an implementation of one of the proposed solutions. We already have a var named |
@robertsLando Perhaps we could use worker-timers https://www.npmjs.com/package/worker-timers when |
Also in terms of @carloscolombo 's solution, we can also use the worker-timers setInterval to handle things. Keeping most of the steps the same, but instead of spawning the web worker ourselves, we can just do this on the connect callback.
you would need to handle the clearInterval on the disconnect. |
Problem is we are actually using |
I have created an issue there: mcollina/retimer#10. I thinnk if we add the support there then we can import the |
Ok |
@robertsLando Any update? I didn't see it in the commit history and also not in the release notes, that's why i'm asking. :) |
I tried to use retimer latest but many tests fail then and I cannot find out why... |
Can you give an update. When will this problem be fixed? |
I don't have an ETA for this, would you like to submit a PR? |
who can tell me this issue has been fixed in which release version? |
@jellybins I submitted a possible fix 4 months ago in version 5.0.0. I also tried to use the retimer solution without success |
@jellybins I switched to eclipse paho javascript and that works great. |
Yeah that's cool last commit was 4 years ago on paho mqtt: https://github.com/eclipse/paho.mqtt.javascript |
For me: |
@oliverunger I'm still waiting for someone to give me feedbacks about this, It could be it is working now... |
#1361 in this issue ,some one tested the version 5.0.3 still have same problem |
latest is 5.3.1, also mine was just a supposition that error was related to this, I need someone that finds a reliable way to reprouce this issue so I can fix it |
version 4.x (such as the last 4.3.7) can reliable reproduce this issue ;and i could not upgrade to version 5.x because using vue2 |
just use this, use the newest google chrome browser and just connect, no need to subscribe , when connected open the preview console and change the browser tab to background, then about every 5 minutes you'll get a disconnect console msg; Ps: i have tried to change the mqtt version to the newest ,but it went wrong; |
What? All my projects are using Vue 2 and I use mqttjs without any problems...
So at the end you have been able to try latest version and it still fails? |
you can try to change the mqtt version to newest in the last link i mentioned,then it compiled error |
I've successfully reproduced this with vite example, it closes after 60s after being put on background. I will try to see what I can do |
Fix available starting from version 5.3.2 |
i tested that,it works normal now , in chinese “稳的一批” |
Thanks for your feedback @jellybins |
https://docs.google.com/document/d/105Hlbcb1mTV06bT9aDpwBotY13eZiKV5Hl4PW5LlyeE/edit
https://developer.chrome.com/blog/timer-throttling-in-chrome-88/
AB#9481421
The text was updated successfully, but these errors were encountered: