Bug #9917

Widget Refresh Logic Flawed

Added by Christopher Embry 10 months ago. Updated 2 months ago.

Web Interface
Target version:
Start date:
Due date:
% Done:


Estimated time:
Affected Version:
Affected Architecture:


Hello team,

I have forked pfSense and resolved this in a feature branch, but need to have a redmine issue for reference when submitting my pull request. Here's a sort of write-up of the issue, and what's been done to resolve it.

[ /usr/local/www/index.php ]
  1. The function `executewidget()` is called every second.
  2. `freq` is defined as the desired number of seconds between each execution of the `ajaxidx`th widget.
  3. If `ajaxcntr % freq` is equal to 0, the `ajaxidx`th widget will run.
  4. At the end of `executewidget()`, `ajaxidx` is increased.
    • If `ajaxidx` is greater than the number of widgets, it is reset to 0 and `ajaxcntr` is also increased. If `ajaxcntr` is greater than 4096, is it reset to 0.

The end result is that each call of `executewidget()` takes `n` seconds to run, where `n` is the number of widgets on the dashboard, and each widget will only execute every `t` times `executewidget()` is run, resulting in an actual update time of `n * t` seconds.

Example, for further illustration:
  • Suppose that there are 8 widgets present on the pfSense dashboard, and the Firewall Logs widget is configured to have an "Update interval" of 10 seconds.
  • A single call of `executewidget()` takes 8 seconds (1 second per widget * 8 widgets total), and Firewall Logs only refreshes every 10 times `updatewidget()` is called.
  • Thus Firewall Logs only refreshes every 8 * 10 seconds, or 80 seconds. This is a bug, and incorrect behavior.
  • This will be fixed through the use of a single `for` loop, each time `executewidget()` is called, that "passes over" all widgets and decides on a per-widget basis if they should be executed (based on `ajaxcntr`).

- NobleKangaroo


#1 Updated by Jim Pingle 10 months ago

  • Category set to Web Interface
  • Status changed from New to Pull Request Review
  • Assignee set to Steve Beaver
  • Target version set to 2.5.0
  • Affected Version set to All
  • Affected Architecture All added
  • Affected Architecture deleted ()

#3 Updated by Steve Beaver 2 months ago

  • Status changed from Pull Request Review to Closed

Also available in: Atom PDF