Bug #15725
closedDashboard widgets refresh at unintended intervals
100%
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
Related issues
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.
Updated by Jim Pingle 3 months ago
- Related to Bug #15373: Firewall Logs Dashboard widget update interval does not behave as expected added
Updated by GChuf 6 2 months ago
- Status changed from Pull Request Review to Feedback
- % Done changed from 0 to 100
Applied in changeset ee615d9d982e94fdb9f5a88207f53990e6e86c1d.
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
Updated by Jim Pingle about 2 months ago
- Plus Target Version changed from 24.08 to 24.11
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.