Bug #6166


requests to diag_system_activity.php can pile up on slow systems

Added by Chris Buechler over 5 years ago. Updated over 5 years ago.

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


Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
Affected Architecture:


from mailing list:

Just upgraded my embedded pfsense to 2.3.
I have problems getting to the box (web or ssh) it just time outs.
On the web I sometime I get Nginx 504, sometime, just nothing.
Eventually I got logged in, try to check what's going on.
I have open Diagnostics->System Activity page, and start monitoring the network traffic.

There is Java Script that updates the page content every 2.5, but actual response in my case was more then 15 sec.
So I ended up with +20 pending requests to /diag_system_activity.php.

I don't think that setInterval is a good option here. Especially when you don't know how long it will take for the request to complete.

My suggestion is to use setTimeout like this:

<script type="text/javascript">
function getcpuactivity() {
            method: 'post',
            data: {
                getactivity: 'yes'
            dataType: "html",
            success: function (data) {
+              setTimeout('getcpuactivity()', 2500);

events.push(function() {
-    setInterval('getcpuactivity()', 2500);
+   setTimeout('getcpuactivity()', 2500);

2.2.x and prior used setTimeout there so that seems reasonable but would like sbeaver to confirm.

Actions #1

Updated by Steve Beaver over 5 years ago

There are a number of problems here. setTimeout is the appropriate function but the call is not quite formatted correctly.

It really needs a mutex to prevent AJAX calls being stacked up.

I will fix these items in a few minutes.

Actions #2

Updated by Steve Beaver over 5 years ago

  • Status changed from Confirmed to Feedback
  • Assignee changed from Steve Beaver to Chris Buechler

AJAX function re-formatted to pfSense style

Added mutex to ensure only one AJAX call is made at a time

Actions #3

Updated by Steve Beaver over 5 years ago

  • % Done changed from 0 to 100
Actions #4

Updated by Chris Buechler over 5 years ago

  • Status changed from Feedback to Resolved



Also available in: Atom PDF