Autologout fires endless Ajax requests if timeout is set to 25 days or higher

Created on 13 July 2022, about 2 years ago
Updated 5 September 2023, about 1 year ago

Problem/Motivation

I have a site where admins should be logged out within hours, but normal customers should be logged out in 30 days. I set the timeout for customers to 30 days, but noticed that the "Please wait" progress icon is constantly flashing at the bottom of the screen and there is heavy network traffic generated by the browser.

Debugging it led me to the setTimeout() call in autologout.js:

              t = setTimeout(init, time);

If time is over 2,147,483,647 ms then the timeout is executed immediately. From https://developer.mozilla.org/en-US/docs/Web/API/setTimeout

Maximum delay value

Browsers including Internet Explorer, Chrome, Safari, and Firefox store the delay as a 32-bit signed integer internally. This causes an integer overflow when using delays larger than 2,147,483,647 ms (about 24.8 days), resulting in the timeout being executed immediately.

This means that the "get time left" Ajax call is made repeatedly, as fast as possible.

Steps to reproduce

Set the timeout to 30 days and watch the network inspector tab in your browser.

Proposed resolution

Set the JS timeout check to e.g. 1 day or 1 hour if the timeout is more than that.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom longwave UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇸🇮Slovenia DeaOm

    There was no reply in about a year, so assuming the issue was fixed with the related issue. Closing this one as outdated, if that is not the case, please re-open.

Production build 0.71.5 2024