Bug #6166

requests to diag_system_activity.php can pile up on slow systems

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

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


Estimated time:
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.

Associated revisions

Revision 79e348e4 (diff)
Added by Steve Beaver over 4 years ago

Fixed #6166

(cherry picked from commit ebaf36ebe5b6f409887d2352db44aba45bf7e086)


#1 Updated by Steve Beaver over 4 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.

#2 Updated by Steve Beaver over 4 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

#3 Updated by Steve Beaver over 4 years ago

  • % Done changed from 0 to 100

#4 Updated by Chris Buechler over 4 years ago

  • Status changed from Feedback to Resolved


Also available in: Atom PDF