Project

General

Profile

Actions

Bug #15725

closed

Dashboard widgets refresh at unintended intervals

Added by GChuf 6 3 months ago. Updated about 1 month ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Dashboard
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
24.11
Release Notes:
Default
Affected Version:
All
Affected Architecture:
All

Description

Here's the PR:
https://github.com/pfsense/pfsense/pull/4697

Current problem:
the widget system does not work as intended - the "interval" is multiplied by the number of active widgets, and so an interval of "1" (meant to be multiplied by 1000 milliseconds) becomes [number of active widgets] seconds instead of 1 second.
Mutex can also block the execution of "refresh" of a widget, resulting in refresh of less widget per "loop".
While testing, mutex was active for about 50% of the time, and so blocked about 50% of the refreshes.
If I remove the mutex and let all the calls run normally, the results are much more predictable.

In the below scenarios, 5 widgets are used: stats, thermal, disk, interfaces (interfaces.php), traffic (ifstats.php).
The refresh intervals are:
stats, disk and interfaces: 1
traffic: 2
thermal: 5

Current behavior in the below picture (notice the irregularity in the calls)

Traffic widget seems to be refreshed as expected, "stats" widget gets called every 5 seconds instead of 1, and thermal widget only gets called once in the time window below.

Behavior after the fix - much more predictable:

1st run:
stats, disk, interfaces

2nd run:
stats, disk, interfaces, traffic

3rd:
stats, disk, interfaces

4th:
stats, disk, interfaces, traffic

5th:
stats, disk, interfaces, thermal

...

10th:
stats, disk, interfaces, traffic, thermal

This means that the "stats" widget gets called every second now, as the default multiplier is 1. I think a multiplier of 5 would be a better starting point, hence the second commit.


Files

getstats_only.png (22.8 KB) getstats_only.png GChuf 6, 09/14/2024 10:36 PM
mutex_output.png (3.44 KB) mutex_output.png GChuf 6, 09/14/2024 10:36 PM
networ_after.png (180 KB) networ_after.png GChuf 6, 09/14/2024 10:36 PM
network_original.png (133 KB) network_original.png GChuf 6, 09/14/2024 10:36 PM

Related issues

Related to Bug #15373: Firewall Logs Dashboard widget update interval does not behave as expectedResolved

Actions
Actions #1

Updated by GChuf 6 3 months ago

I've also tested what happens if only 1 widget is active on the master branch - in my case the system informartion ("stats") widget.
results:

Not sure why it gets called every 2 seconds instead of one, but it might be the fault of mutex - i haven't checked.
If mutex was meant for the calls to be strictly sequential and not concurrent, an "if" statement is not OK in any case. I think we can keep the calls concurrent and focus on optimizing the calls instead.

The fix was tested on version 2.7.2.

Actions #2

Updated by Jim Pingle 3 months ago

  • Related to Bug #15373: Firewall Logs Dashboard widget update interval does not behave as expected added
Actions #3

Updated by Marcos M 2 months ago

  • Subject changed from Widget refresh bug to Widgets refresh at unintended intervals
  • Assignee set to Marcos M
  • Target version set to 2.8.0
  • Plus Target Version set to 24.08
Actions #4

Updated by GChuf 6 2 months ago

  • Status changed from Pull Request Review to Feedback
  • % Done changed from 0 to 100
Actions #5

Updated by Jim Pingle about 2 months ago

  • Subject changed from Widgets refresh at unintended intervals to Dashboard widgets refresh at unintended intervals
  • Category changed from Web Interface to Dashboard
Actions #6

Updated by Jim Pingle about 2 months ago

  • Plus Target Version changed from 24.08 to 24.11
Actions #7

Updated by Christopher Cope about 1 month ago

  • Status changed from Feedback to Resolved

Tested on

24.11-ALPHA (amd64)
built on Fri Oct 18 15:52:00 UTC 2024
FreeBSD 15.0-CURRENT

The behavior is much better now. Stats, disk and interfaces are all 5 second refresh intervals now and everything seems consistent. Marking resolved.

Actions

Also available in: Atom PDF