Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    High CPU Usage after upgrading to 22.05

    Scheduled Pinned Locked Moved pfBlockerNG
    32 Posts 13 Posters 4.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dennypageD
      dennypage
      last edited by

      Known issue with a simple fix.

      1 Reply Last reply Reply Quote 0
      • M
        Mike-moon
        last edited by

        Hi all, I have applied the fix referenced above but I still have 30-40% CPU usage at an i3 with 3.7GHz. With the previous version 22.01 the CPU usage was typically below 10%.
        Could there be an additional issue?
        Thanks, Mike

        M 1 Reply Last reply Reply Quote 0
        • sretallaS
          sretalla
          last edited by

          I can confirm I saw the issue with pfBlocker and was able to fix it by following this patch (already linked via posts above):
          https://redmine.pfsense.org/issues/13154s

          I guess I don't need to say what time I performed the fix. (I needed to restart pfBlocker after doing it)

          aa0a1ecd-913e-4578-981c-9962a9f986f9-image.png

          3066dd36-0e28-4762-b275-76594b5bcaea-image.png

          1 Reply Last reply Reply Quote 0
          • M
            Mike-moon @Mike-moon
            last edited by

            @mike-moon said in High CPU Usage after upgrading to 22.05:

            Hi all, I have applied the fix referenced above but I still have 30-40% CPU usage at an i3 with 3.7GHz. With the previous version 22.01 the CPU usage was typically below 10%.
            Could there be an additional issue?
            Thanks, Mike

            Sorry, I made a mistake when applying the fix: I removed the bracket between the two quotes but did not replace that bracket by a space as required. After correcting this the CPU usage jumped down and the core temperatures decreased about 10 degrees. So everything is fine.
            Mike

            T johnpozJ 2 Replies Last reply Reply Quote 0
            • T
              tohil @Mike-moon
              last edited by tohil

              Hi,

              Upgraded the first firewall to 22.05, but I'm not experiencing high cpu load by pfblockerng.
              has this issue already been fixed in a new package release?

              /usr/local/pkg/pfblockerng/pfblockerng.inc on line 4139 at my install:

               foreach ($list_type as $ip_type => $vtype) {
                                      if (!empty($config['installedpackages'][$ip_type]['config'])) {
                                              foreach ($config['installedpackages'][$ip_type]['config'] as $key => $list) {
                                                      if (!is_array($list)) {
                                                              $list = array();
                                                      }
                                                      if (!is_array($list['row'])) {
                                                              $list['row'] = array();
                                                      }
              
                                                      if ($vtype == '_v4') {
                                                              $list['vtype'] = '_v4';
                                                      } else {
                                                              $list['vtype'] = '_v6';
                                                      }
              
                                                      // Collect list array key location
                                                      $list['key'] = "{$key}";
              
                                                      // If only the 'customlist' is defined. Remove the 'List row' data.
                                                      if (empty($list['row'][0]['url'])) {
                                                              unset($list['row']);
                                                      }
              
              
              fireodoF 1 Reply Last reply Reply Quote 0
              • fireodoF
                fireodo @tohil
                last edited by

                @tohil said in High CPU Usage after upgrading to 22.05:

                /usr/local/pkg/pfblockerng/pfblockerng.inc on line 4139 at my install:

                Maybe your Texteditor is counting wrong:

                Here at line 4139 is "$r = explode(' ', $result, 2);"

                Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                pfsense 2.7.2 CE
                Packages: Apcupsd Cron Iftop Iperf LCDproc Nmap pfBlockerNG RRD_Summary Shellcmd Snort Speedtest System_Patches.

                T 1 Reply Last reply Reply Quote 0
                • T
                  tohil @fireodo
                  last edited by

                  @fireodo said in High CPU Usage after upgrading to 22.05:

                  $r = explode(' ', $result, 2)

                  Hi

                  I'm using vi and jump to:4139

                  I even cannot find that line....
                  vi /usr/local/pkg/pfblockerng/pfblockerng.inc

                  fireodoF 1 Reply Last reply Reply Quote 0
                  • fireodoF
                    fireodo @tohil
                    last edited by fireodo

                    @tohil said in High CPU Usage after upgrading to 22.05:

                    @fireodo said in High CPU Usage after upgrading to 22.05:

                    $r = explode(' ', $result, 2)

                    Hi

                    I'm using vi and jump to:4139

                    I even cannot find that line....
                    vi /usr/local/pkg/pfblockerng/pfblockerng.inc
                    If you trust me:
                    pfblockerng.txt
                    You have to change the .txt to .inc
                    Changes are allready made - you can replace the file directly.

                    Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                    SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                    pfsense 2.7.2 CE
                    Packages: Apcupsd Cron Iftop Iperf LCDproc Nmap pfBlockerNG RRD_Summary Shellcmd Snort Speedtest System_Patches.

                    T 1 Reply Last reply Reply Quote 0
                    • T
                      tohil @fireodo
                      last edited by

                      @fireodo
                      Okay, now its going kind of weird. I've compared my file (putty.log) with your text...
                      it seems like the file version is not the same....
                      alt text

                      fireodoF 1 Reply Last reply Reply Quote 0
                      • fireodoF
                        fireodo @tohil
                        last edited by

                        @tohil
                        Hmmm,

                        I have here pfblocker 3.1.0_4 devel and this pfblocker.inc file

                        Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                        SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                        pfsense 2.7.2 CE
                        Packages: Apcupsd Cron Iftop Iperf LCDproc Nmap pfBlockerNG RRD_Summary Shellcmd Snort Speedtest System_Patches.

                        T 1 Reply Last reply Reply Quote 0
                        • T
                          tohil @fireodo
                          last edited by tohil

                          @fireodo
                          I have pfBlocker 2.1.4_27

                          Is this issue just with dev version?
                          Checked the bugtracker entry:

                          I'm running this on 22.01-Release and this was CPU load was not occurring prior to 3.1.0.4.
                          

                          So everyone not using pfBlockerNG higher than 3.1.04 will be affected...

                          fireodoF 1 Reply Last reply Reply Quote 0
                          • fireodoF
                            fireodo @tohil
                            last edited by fireodo

                            @tohil said in High CPU Usage after upgrading to 22.05:

                            @fireodo
                            I have pfBlocker 2.1.4_27

                            Is this issue just with dev version?

                            Ooooh - in this case the file is NOT for this old Version!!! But the problem is the same the line number must be in this old version different - I suggest to upgrade to the devel version wich is actually maintained! But its in the end your decision!

                            Edit: If you find in your pfblocker .inc

                            $r = explode(')', $result, 2);
                            

                            then you should replace it with:

                            $r = explode(' ', $result, 2);
                            

                            Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                            SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                            pfsense 2.7.2 CE
                            Packages: Apcupsd Cron Iftop Iperf LCDproc Nmap pfBlockerNG RRD_Summary Shellcmd Snort Speedtest System_Patches.

                            1 Reply Last reply Reply Quote 0
                            • T
                              tohil
                              last edited by tohil

                              @fireodo
                              https://forum.netgate.com/topic/156604/pfblockerng-vs-pfblockerng-devel/7

                              https://forum.netgate.com/topic/172036/solved-pfblocker-stable-vs-devel/3

                              It seems I have to update and go to the devel version on all my installs...

                              fireodoF 1 Reply Last reply Reply Quote 0
                              • fireodoF
                                fireodo @tohil
                                last edited by fireodo

                                @tohil said in High CPU Usage after upgrading to 22.05:

                                @fireodo
                                https://forum.netgate.com/topic/156604/pfblockerng-vs-pfblockerng-devel/7

                                It seems I have to update and go to the devel version on all my installs...

                                That would (from my point of view) be a good move ...
                                (as far I recall, there should be no problems and all your settings are preserved - but BACKUP is allways recommended 😏 )

                                Kettop Mi4300YL CPU: i5-4300Y @ 1.60GHz RAM: 8GB Ethernet Ports: 4
                                SSD: SanDisk pSSD-S2 16GB (ZFS) WiFi: WLE200NX
                                pfsense 2.7.2 CE
                                Packages: Apcupsd Cron Iftop Iperf LCDproc Nmap pfBlockerNG RRD_Summary Shellcmd Snort Speedtest System_Patches.

                                1 Reply Last reply Reply Quote 1
                                • johnpozJ
                                  johnpoz LAYER 8 Global Moderator @Mike-moon
                                  last edited by

                                  @mike-moon said in High CPU Usage after upgrading to 22.05:

                                  I removed the bracket between the two quotes but did not replace that bracket by a space as required

                                  I made the same mistake doing the patch by hand - hehehe

                                  Yup what a difference.

                                  space.jpg

                                  I was thinking that "fix" didn't seem to do much.. Then as you can see from graph after putting in the space between the 's cpu util dropped off to normal, and yup did see a couple of degrees difference in the temp as well.

                                  An intelligent man is sometimes forced to be drunk to spend time with his fools
                                  If you get confused: Listen to the Music Play
                                  Please don't Chat/PM me for help, unless mod related
                                  SG-4860 24.11 | Lab VMs 2.7.2, 24.11

                                  F 1 Reply Last reply Reply Quote 0
                                  • F
                                    FrankZappa @johnpoz
                                    last edited by

                                    @johnpoz Johnpoz, can you give a "how to for idiots" on changing the script?
                                    I've never changed the script file and not sure how to do it e.g. What software (Putty?/Text Editor, etc) and where do I go to change it.

                                    Sorry, I'm a newbie at this.

                                    T sretallaS 2 Replies Last reply Reply Quote 0
                                    • T
                                      tohil @FrankZappa
                                      last edited by

                                      @frankzappa
                                      Hi

                                      connect to your pfsense via putty.

                                      enter the following

                                      vi /usr/local/pkg/pfblockerng/pfblockerng.inc
                                      

                                      Then press "ESC" followed by ":" enter line number 4139

                                      cursor jumps to the line.

                                      go to the part to change, like the e of explode. press ESX followed by x. this removes char by char. delete all behind the e until then ;

                                      $r = ;
                                      

                                      then copy the new part

                                      explode(' ', $result, 2)
                                      

                                      Press ESC and I

                                      then paste it with right click.

                                      ESC / wq to save

                                      reboot

                                      hope this helps

                                      1 Reply Last reply Reply Quote 0
                                      • sretallaS
                                        sretalla @FrankZappa
                                        last edited by

                                        @frankzappa

                                        Just do it from the pfSense GUI.

                                        In the Diagnostics menu, go to Edit File

                                        Type (or copy/paste) /usr/local/pkg/pfblockerng/pfblockerng.inc into the "Path of file to be edited" box and click "Load"

                                        Type 4139 in the "Go to line #" box just below that and to the right, then click the button.

                                        Make the edit (change the '?' to ' ' ensuring to make a space between the single quotes)

                                        Click the "Save" button.

                                        F 1 Reply Last reply Reply Quote 0
                                        • F
                                          FrankZappa @sretalla
                                          last edited by

                                          @sretalla Thanks folks, that seemed to work (using Edit File from GUI). Didn't know there was a GUI option to do that (although I'm familiar with Putty as well). Thanks for the help.

                                          F 1 Reply Last reply Reply Quote 0
                                          • F
                                            FrankZappa @FrankZappa
                                            last edited by

                                            @frankzappa Update: Everything working Great! CPU usage is way down as well as temps.. This was an awesome fix!
                                            As an aside: Holy Cow! You have to be pretty good at coding to find that error. Some smart dudes figured that one out. I'm not one of them!!!

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.